The app I am working on has the bottom ActionBar for the MainActivity set in Menifest as
<meta-data
android:name="android.support.UI_OPTIONS"
android:value="splitActionBarWhenNarrow" />
As I am using Navigation Drawer and I want to add some Items to the Top ActionBar of one of the Fragment on Navigation. But when I add an item it always show up in the bottom ActionBar. I need some help how can I achieve this, as I am using Fragment not activity and I cannot add this in Menifest for the Fragment.
Related
I'm writing my first app. I've done some practicals with Google Codelabs and learned to add an up navigation arrow to the app bar. When I try it with my app the navigation arrow is not anywhere.
The only difference between the practical and my code is the theme, which I've tried to change but the app stops when I do because I am not using an AppCompat theme which I have not learned yet. But I do not know if the theme is the problem.
<activity
android:name=".Lists"
android:label="#string/title_activity_lists"
android:parentActivityName=".MainActivity"
android:theme="#style/AppTheme.NoActionBar">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.fourwomendev.simplyneatlist.MainActivity" />
</activity>
I expect a left pointing arrow to the left of the title of the activity Lists on the app bar, but there is not one.
I'm writing my first app. I've done some practicals with Google
Codelabs and learned to add an up navigation arrow to the app bar.
When I try it with my app the navigation arrow is not anywhere.
Because you are not using any Actionbar in your activity.
<activity
android:name=".Lists"
android:label="#string/title_activity_lists"
android:parentActivityName=".MainActivity"
android:theme="#style/AppTheme.NoActionBar" //<-----no actionbar is
specified
>
.......
</activity>
Use one actionbar to get the left arrow.
In trying to work with errors from changing the theme I realized that the basic activity I chose when creating this activity is created with a toolbar in Java. So I took out the code that created the toolbar and the reference to the theme in XML and my up navigation arrow appeared.
I have a main activity with bottom nav and a frame layout to hold each fragment I have made for the numbers of icon in my botton nav. I have a fragment page in which i have a text and want to change the fragment and also the bottom nav icon from the click action on text.
Please refer to below links :
Android new Bottom Navigation bar or BottomNavigationView
How to Code a Bottom Navigation Bar for an Android App
Android Working with Bottom Navigation
I'm developing an application with a side navigation menu.
In my activities, the action bar of the activity I'm loading overlays the action bar with the side navigation menu. Even though the side menu is there and works fine.
Home page with the side navigation:
Side navigation works when swiping:
I want to hide or remove the activity's action bar while maintaining the side navigation menu.
This is the code from the onCreate() method
FrameLayout contentFrameLayout = (FrameLayout) findViewById(R.id.content_frame);
getLayoutInflater().inflate(R.layout.activity_complaint, contentFrameLayout);
you can do 2 things
you can provide padding to the side navigation menu , so that the side navigation menu will be displayed just below the action bar
another thing you can do is to hide the Action bar when Navigation Drawer icon is clicked
the code to hide Action bar is below
android.support.v7.app.ActionBar AB= getSupportActionBar();
AB.hide();
I found a solution using the answer from this question:
How to Display Navigation Drawer in all activities?
and adding this bit of code to my activity in the Manifest.xml file
android:theme="#style/AppTheme.NoActionBar"
I have one activity which has two fragments.
I have defined following option for the activity in manifest file-
android:uiOptions="splitActionBarWhenNarrow"
I want the action bar at bottom for one fragment and at top for another fragment.
How can I do this?
The action bar is tied to the activity, not the fragments. If you need a bar with buttons somewhere in the middle of your activity, you'll have to add something yourself. Perhaps a button bar that is styled to look like an action bar.
I have implemented ActionBar in my app and I have 3 tabs (Fragments) inside the actionbar.
I want to show options (light blue colored bar in screenshot) with some buttons at the bottom of the screen.
Can someone guide me about how to implement this?
Thanks
to display the actionbar menu items at the bottom add to the activity element in the manifest file this attribute
android:uiOptions="splitActionBarWhenNarrow"
example:
<activity
android:name=".HomeScreen"
...
...
android:uiOptions="splitActionBarWhenNarrow">
Ok. I got your question. You can try a tab host for upper tabs and relative layout for the below bar where you can put your stuff.