Witam, jestem początkującym jeżeli chodzi o programowanie w Androidzie i napotkałem na problem już przy etapie tworzenia menu w aplikacji.
res/menu
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:hmkcode="http://schemas.android.com/apk/res-auto"
>
<item
android:id="@+id/menu_delete"
android:orderInCategory="100"
hmkcode:showAsAction="ifRoom"
android:title="@string/delete" />
<item
android:id="@+id/menu_edit"
android:orderInCategory="100"
hmkcode:showAsAction="ifRoom"
android:title="@string/edit" />
<item
android:id="@+id/menu_share"
android:orderInCategory="100"
hmkcode:showAsAction="ifRoom"
android:title="@string/share" />
</menu>
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
MenuInflater menuInflater = getMenuInflater();
menuInflater.inflate(R.menu.main, menu);
return true;
}
}
W takim wypadku w oknie menu nic się nie pokazuje. Natomiast jeżeli rozszerzę klasą MainActivity o ActionBarActivity to w oknie menu pojawi się po prawej stronie przycisk Delete i Edit, ale już nie Share (wygląda na to, że 3 item z res/menu już z jakiegoś względu nie jest brany pod uwagę). Mógłby mi ktoś powiedzieć, dlaczego tak się dzieję ?