Forum Xamarin.Android

Announcement:

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:

<LinearLayout
    android:id="@+id/DotMenuPlayRow"
    style="@style/ListMenuRow"
    android:background="#000000">
    <LinearLayout
        style="@style/ListMenuRowContent"
        android:background="#000000">
        <Musicnotes.Android.ViewerMenuButton
            style="@style/ViewerDotMenuIcon"
            android:id="@+id/StartPlayingButton" />
        <TextView
            style="@style/ListMenuRowText"
            android:text="Play" />
    </LinearLayout>
    <View
        style="@style/DividerLightGray" />
</LinearLayout>

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>

<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>
</style>

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.