Android L is ignoring shapes as drawable background

前端 未结 2 1987
执笔经年
执笔经年 2021-02-13 22:14

I\'m testing Android L Preview on my Nexus 5. I\'ve got problem with my app.

I\'ve got some TextViews with background set:

android:background=\"@drawable         


        
相关标签:
2条回答
  • 2021-02-13 22:41

    I found that wrapping the shape in a selector and item tag made it work

    <selector xmlns:android="http://schemas.android.com/apk/res/android">
        <item>
            <shape android:shape="rectangle">
    
                <solid android:color="@color/gray" />
    
                <corners
                    android:bottomLeftRadius="3dp"
                    android:topRightRadius="3dp"
                    android:topLeftRadius="3dp"
                    android:bottomRightRadius="3dp" />
    
            </shape>
        </item>
    </selector>
    
    0 讨论(0)
  • 2021-02-13 22:51

    Just use android:radius, not use each corner options. I had a same problem, but I was able to solve the problem using this way.

    <?xml version="1.0" encoding="utf-8"?>
    <shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" android:padding="3dp">
    <solid android:color="#999999"/>
      <corners android:radius="2dp"/>
    </shape>
    
    0 讨论(0)
提交回复
热议问题