Forum Xamarin.Android


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

android:background not always respected in 5.0

pmhart83pmhart83 USMember ✭✭✭
edited May 2015 in Xamarin.Android

Working on an Android update to our app for 5.0. There is a layover menu that now has a solid blue background. The menu has a variety of "rows" which are LinearLayout objects. In the XML each LinearLayout row has a style. The style has a background of #000000. But when the app is compiled and viewed in Android 5.0, the rows do NOT have a black background. The property is respected on < 5.0.

Here is some code for a row:

            android:id="@+id/StartPlayingButton" />
            android:text="Play" />
        style="@style/DividerLightGray" />

In styles.xml

<style name="ListMenuRow">
    <item name="android:orientation">vertical</item>
    <item name="android:layout_width">fill_parent</item>
    <item name="android:layout_height">48dp</item>
    <item name="android:gravity">center</item>

<style name="ListMenuRowContent">
    <item name="android:background">#000000</item>
    <item name="android:orientation">horizontal</item>
    <item name="android:layout_width">fill_parent</item>
    <item name="android:layout_height">fill_parent</item>
    <item name="android:padding">6dp</item>
    <item name="android:gravity">center</item>

Note that a back background is also hard-coded in the top view tag. Is this a common issue with Android 5.0? I know it's not Xamarin's fault ... but any insight?

Finally note: the tag above each "row" has drawable background which is blue with a corner radius of 10dp. This what I see, nothing above!

Sign In or Register to comment.