Hi,
I am trying to create an action bar.
I have an application with DrawerLayout
that has inside a ViewPager... and I implement a PagerAadapter and a class for the page fragment.
this is the activity_main.xml under layout folder
( I REMOVED xmlns LINK DOTS AND SLASH SO I CAN POST THIS)
[HIGH]<android.support.v4.widget.DrawerLayout
xmlns:android="httpschemasandroidcomapkresandroid"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<!-- This is the main-->
<android.support.v4.view.ViewPager xmlns:android="httpschemasandroidcomapkresandroid"
xmlns:tools="schemasandroidcomtools"
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<!--
This title strip will display the currently visible page title, as well as the page
titles for adjacent pages.
-->
<android.support.v4.view.PagerTitleStrip
android:id="@+id/pager_title_strip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:background="#33b5e5"
androidaddingBottom="4dp"
androidaddingTop="4dp"
android:textColor="#fff" />
</android.support.v4.view.ViewPager>
<ListView
android:id="@+id/optionsMenu"
android:background="#000000"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp" />
</android.support.v4.widget.DrawerLayout>[/HIGH]
And this is the main.xml found in menu folder
( I REMOVED xmlns LINK DOTS AND SLASH SO I CAN POST THIS)
[HIGH]<menu xmlns:android="httpschemasandroidcomapkresandroid">
<item android:id="@+id/action_settings"
android:title="@string/action_settings" />
<item android:id="@+id/action_details"
android:title="@string/action_details" />
<item android:id="@+id/action_details2"
android:title="@string/action_details2" />
</menu>
[/HIGH]
The problem is that It doesn't even reach onCreateOptionsMenu on the MainActivity... I tried everything:
- change android:minSdkVersion to 7, 11 and 14 (in the manifest uses-sdk tag)
- add attribute to menu items "showAsAction", and remove that attribute too
- make my page fragment override onCreateOptionsMenu
i debug it and it never reaches onCreateOptionsMenu, anywhere.
and the getActionBar() is of course null.
thanks!
I am trying to create an action bar.
I have an application with DrawerLayout
that has inside a ViewPager... and I implement a PagerAadapter and a class for the page fragment.
this is the activity_main.xml under layout folder
( I REMOVED xmlns LINK DOTS AND SLASH SO I CAN POST THIS)
[HIGH]<android.support.v4.widget.DrawerLayout
xmlns:android="httpschemasandroidcomapkresandroid"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<!-- This is the main-->
<android.support.v4.view.ViewPager xmlns:android="httpschemasandroidcomapkresandroid"
xmlns:tools="schemasandroidcomtools"
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<!--
This title strip will display the currently visible page title, as well as the page
titles for adjacent pages.
-->
<android.support.v4.view.PagerTitleStrip
android:id="@+id/pager_title_strip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:background="#33b5e5"
androidaddingBottom="4dp"
androidaddingTop="4dp"
android:textColor="#fff" />
</android.support.v4.view.ViewPager>
<ListView
android:id="@+id/optionsMenu"
android:background="#000000"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp" />
</android.support.v4.widget.DrawerLayout>[/HIGH]
And this is the main.xml found in menu folder
( I REMOVED xmlns LINK DOTS AND SLASH SO I CAN POST THIS)
[HIGH]<menu xmlns:android="httpschemasandroidcomapkresandroid">
<item android:id="@+id/action_settings"
android:title="@string/action_settings" />
<item android:id="@+id/action_details"
android:title="@string/action_details" />
<item android:id="@+id/action_details2"
android:title="@string/action_details2" />
</menu>
[/HIGH]
The problem is that It doesn't even reach onCreateOptionsMenu on the MainActivity... I tried everything:
- change android:minSdkVersion to 7, 11 and 14 (in the manifest uses-sdk tag)
- add attribute to menu items "showAsAction", and remove that attribute too
- make my page fragment override onCreateOptionsMenu
i debug it and it never reaches onCreateOptionsMenu, anywhere.
and the getActionBar() is of course null.
thanks!