mardi 12 août 2014

Java - affichage actionbar onglets ci-dessous un schéma de xml - Stack Overflow


I have successfully implemented the action bar and actionbar tabs in my app's UI. But the actionbar tabs always comes right after the action bar. I need to display a page header's xml view right after the actionbar. Right now even with the placements in xml the actionbar tabs always appear right after the action bar. Any ideas?


Thanks in advance.




I think that you can't do it. My suggestion is that you could disable the actionbar tabs and use viewpager component. You can put the viewpager inside of xml layout and you can set up tabs into the viewpager. For each page/tab of the viewpager, you could insert a fragment.


In that way, you can distribute the views of your screen how do you prefer.


Anyway, the ActionBar will be in the top of your screen filling all the width of your app.




Another suggestion will be to use a DropDown Navigation inside your ActionBar.


Why a Spinner to my ViewPager whereas I wanted Tabs with header xml?


The answer is simple: Tabs with ActionBar are taking some relevant space on your device. When you change the orientation, your Tabs, most of the time, change to a DropDown Navigation to gain some space and display the content in more efficient way. Use, at the start for each configuration, a DropDown Navigation allow you to have a navigation for your ViewPager without loose in dynamic and without lose some relevant space to display your header in xml. I think you should consider all devices and their screen sizes.




You can try this


You can change the abs__screen_action_bar.xml in action-bar lib if you are using lib project for action bar and tabs.


you can change this xml layout according to your need.



I have successfully implemented the action bar and actionbar tabs in my app's UI. But the actionbar tabs always comes right after the action bar. I need to display a page header's xml view right after the actionbar. Right now even with the placements in xml the actionbar tabs always appear right after the action bar. Any ideas?


Thanks in advance.



I think that you can't do it. My suggestion is that you could disable the actionbar tabs and use viewpager component. You can put the viewpager inside of xml layout and you can set up tabs into the viewpager. For each page/tab of the viewpager, you could insert a fragment.


In that way, you can distribute the views of your screen how do you prefer.


Anyway, the ActionBar will be in the top of your screen filling all the width of your app.



Another suggestion will be to use a DropDown Navigation inside your ActionBar.


Why a Spinner to my ViewPager whereas I wanted Tabs with header xml?


The answer is simple: Tabs with ActionBar are taking some relevant space on your device. When you change the orientation, your Tabs, most of the time, change to a DropDown Navigation to gain some space and display the content in more efficient way. Use, at the start for each configuration, a DropDown Navigation allow you to have a navigation for your ViewPager without loose in dynamic and without lose some relevant space to display your header in xml. I think you should consider all devices and their screen sizes.



You can try this


You can change the abs__screen_action_bar.xml in action-bar lib if you are using lib project for action bar and tabs.


you can change this xml layout according to your need.


0 commentaires:

Enregistrer un commentaire