android - Change actionbar to overlay from within Fragment -
I have a piece (piece 1) that has been replaced by another volume (piece 2). The piece is placed on 1 stack. I'm using compatibility mode (not ActionBarSherlock)
Here's my problem. I want the taskbar to be displayed as an overlay in some pieces, but not in others. Specifically, when 2 pieces are shown, I want to show it in the overlay and then want to return to normal operation after a piece 2 goes out.
Piece 1 has a regular taskbar which is always visible but, when I change the fragment 1 with segment 2, then I need to hide the actionbars after 5 seconds. If there is a touch event, the operation has been shown again. It all works well, but, every time the proceedings are hidden or discovered, then section 2 is re-prepared. For this reason, I want to create an action bar in the frigate 2 show as an overlay.
I know that I can change the actionbar overlay, but I do not know how to program this from inside the piece. I do not want to change it for every piece, just segment 2
Thoughts
This is not the answer you were hoping for.
Consider a different question: Did we call Your question is an extension - with the complexity of changing theme from one piece to another. In any case, I do not consider the solution mentioned above in a good way. The actionbase is one of the first components to start when the activity is created. I do not think you will find a way to 'refresh' somehow with new qualities. See below how So, if Is it possible that you do not even need this functionality? To show the action bar overlay in your theme: Here's my problem I want to show the action in some pieces as an overlay ... OK . We are already provided for it. ... but not in others Say that you do not want to have an action-line as an overlay in Fragment B. Then, in the layout of Fragment B., do the following: With set top-margin set in the shape of the actionbars, the piece looks like B. It has a regular actionbase - not a single one, there will be another way to get it In short: A point of note ( If your setContentView (...) ? The question has been asked a number of times, and a normal solution is to recreate (calling
finish () and
startActivity (getIntent ()) ) and first new topic Set
setContentView (...) .
requestFeature (Window.FEATURE_ACTION_BAR_OVERLAY) method deals with post-set contentview (...) calls:
@ Override public boolean requestfeature (Int. Feature id) {if (mContentParent! = Tap) {new AndroidRuntimeException ("requestFeature () should be said before adding content"); } .... ....
setContentView (...) has already been called for activity (which is it Your case), a runtime-exception will be thrown.
& lt; Item name = "android: windowActionBarOverlay" & gt; True & lt; / Item & gt; & Lt ;! - Support library for compatibility - & gt; & Lt; Item name = "windowActionBarOverlay" & gt; True & lt; / Item & gt;
& lt; LinearLayout xmlns: Android = "http://schemas.android.com/apk/res/android" Android: ID = "@ + ID / Drawer_layout" Android: layout_width = "match_parent" Android: layout_height = "match_parent" Android: Layout_marginTop = "Android: ATR / Actionbirds" & gt; & Lt; & Lt; & Lt; -? Attr / actionBarSize for compatibility .... .... & lt; / LinearLayout & gt;
See
android: layout_height = "Android: attr / actionBarSize" with as the first child in the layout given above.
actionBarSize in pieces of action where the ActionBar should not be overlaid.
thanks for jell :
actionbars semi transparent, it would be best to use padding instead of margin for a consistent form
Comments
Post a Comment