Android Weird Huge Menu sizes -
hi been trying add together share feature app. testing on moto g.
but sharemenu huge , larger screen. seems ok in portrait mode. brakes in landscape.
http://postimg.org/image/ne7zzup43/
anyway original code https://github.com/pocmo/instant-mustache/blob/article-09/src/com/androidzeitgeist/mustache/activity/photoactivity.java
seemed work, maybe because locked portrait>
i had alter code add together more menu items, share sub menu went weird.
heres current code.
@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); uri = getintent().getdata(); setcontentview(r.layout.activity_photo); imageview photoview = (imageview) findviewbyid(r.id.photo); photoview.setimageuri(uri); } @override public boolean oncreateoptionsmenu(menu menu) { //getmenuinflater().inflate(r.menu.activity_photo_menu, menu); //return super.oncreateoptionsmenu(menu); menuinflater inflater = getmenuinflater(); inflater.inflate(r.menu.activity_photo_menu, menu); homecoming true; } private void sharephoto() { intent share = new intent(intent.action_send); share.putextra(intent.extra_stream, uri); share.settype(mime_type); startactivity(intent.createchooser(share, "share")); } @override public boolean onoptionsitemselected(menuitem item) { switch (item.getitemid()) { case r.id.menu_item_share: sharephoto(); homecoming true; case r.id.take_another: toast.maketext(getapplicationcontext(), "go main activity", toast.length_long).show(); homecoming true; } homecoming false; } protected void onresume() { super.onresume(); invalidateoptionsmenu(); ///????? redraw menu on rotate????? }
here current menu xml
<?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@+id/menu_item_share" android:actionproviderclass="android.widget.shareactionprovider" android:showasaction="ifroom" android:title="@string/action_share"/> <item android:title="@string/take_another" android:id="@+id/take_another"></item> </menu>
manifest //(no sdk requirements set)
<activity android:name="com.mycompany.myapp.photo.photoactivity" android:label="@string/app_name" />
photoactivity xml
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <imageview android:id="@+id/photo" android:layout_width="match_parent" android:layout_height="match_parent" android:scaletype="centerinside" /> </linearlayout>
android menu
No comments:
Post a Comment