I'm new in the world of android. Until now each and every "OptionsMenu" could be created like this:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_list_view_controller, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle item selection
switch (item.getItemId()) {
case R.id.menu_settings:
startActivity(new Intent (ListViewControllerActivity.this, PreverencesActivity.class));
return true;
case R.id.menu_devsettings:
startActivity(new Intent (ListViewControllerActivity.this, DevPreferencesActivity.class));
return true;
default:
return super.onOptionsItemSelected(item);
}
}
But now , for example, the new htc one have no hardware OptionsMenu button. When the OptionsMenu is implemented like my source, the menubutton inside the display won't show up. How can implement the OptionsMenu right, that no additional button in the layout is needed? Or can this button inside the display somehow be activated?
EDIT: I think I gave a little less information to solve the problem, because the android won't take care of it in API 16 Jelly Bean. So again. I've implemented the option menu like above. But now with the "htc one" which has no hardware option menu button, the in-screen option menu button doesn't show up.
Here is my layout xml, which i'm using (it could be a layout problem):
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="@+id/img_logo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true" />
<TextView
android:id="@+id/txt_title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:background="#1e4870"
android:textColor="#ffffff"
android:layout_below="@+id/img_logo"/>
<ListView
android:id="@android:id/list"
android:layout_below="@+id/txt_title"
android:layout_above="@+id/img_bottom_bar"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</ListView>
<ImageView
android:id="@+id/img_bottom_bar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/footer"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:background="@android:drawable/bottom_bar"
android:src="@android:drawable/bottom_bar" />
<RelativeLayout
android:id="@+id/footer"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:orientation="vertical" >
<TextView
android:id="@+id/footer_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_toLeftOf="@+id/footer_img_bs"
android:textAppearance="?android:attr/textAppearanceSmall" />
<ImageView
android:id="@+id/footer_img_bs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:src="@drawable/ic_launcher" />
</RelativeLayout>
</RelativeLayout>
And here the part of the manifest, which i thought would solve this problem:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
I've also googled this problem many times. But it seems that i'm the only person around here with that problem. So i have to be a little stupid or something.
Before I forget: Thank you WebnetMobile.com for trying to help me. It could be that i'm just (like i've said before) too stupid to understand your answer.