Listview and Action bar TRANSPARENT in android -
There is a list view in my activity and action bar for transparent and activity set on the UP navigation. The results are displayed properly But the first thing is visible below the action. Like the image below:
I am using the bar to make it transparent:
getWindow (). RequestFeature (window.FEATURE_ACTION_BAR_OVERLAY); ActionBoard ActionBar = Matching Actionbar (); ActionBar.setBackgroundDrawable (New ColorDrawable (android.graphics.color.TRANSPARENT)); ActionBar.setStackedBackgroundDrawable (New ColorDrawable (android.graphics.Color.TRANSPARENT)); GetActionBar () setDisplayHomeAsUpEnabled (true). GetActionBar () setDisplayShowHomeEnabled (incorrect). SetContentView (R.layout.invite_friends);
For the invite list, .ML:
& lt; LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android" Android: layout_width = "fill_parent" Android: layout_height = "fill_parent" Android: background = "@draubable / blackback ground" Android: Orientation = "Vertical" & gt; & Lt; ListView Android: Android: layout_width = "fill_parent" Android: layout_height = "wrap_content" android: divider = "# b5b5b5" Android: dividerHeight = "1dp" Android: listSelector = "@drawable / list_selector" /> & Lt; / LinearLayout & gt;
It's surprising that the list view is thinking that this is a full screen? How to solve this issue?
Thank you!
The problem is:
getWindow (). RequestFeature (window.FEATURE_ACTION_BAR_OVERLAY);
You are saying ActionBar
in overlay mode, that means it will overlay the content instead of at a fixed location. This is useful if you want to dynamically hide and show ActionBar
in your app, but ActionBar
is not required to be transparent. Just remove it and you should work as expected.
If you want or if you need the If you are using a support library, do you have ActionBar
overlay mode, you can apply a padding to the content in your code> Activity which is ActionBar is equal to altitude like this:
& lt; Relative layout xmlns: Android = "http://schemas.android.com/apk/res/android" Android: layout_width = "match_parent" Android: layout_height = "match_parent" android: paddingtop = "? Android: ATR / actionbars" Gt; ... & lt; / Relative layout & gt;
? Attr / actionBarSize
insted of
? Android: ATR / Actionbars is
to use:
& lt ;! - Support library compatibility - & gt; & Lt; RelativeLayout xmlns: Android = "http://schemas.android.com/apk/res/android" Android: layout_width = "match_parent" android: layout_height = "match_parent" android: paddingTop = "? Act / actionbarsis" & gt; ... & lt; / Relative layout & gt;
Comments
Post a Comment