Android的L被忽略形状,绘制背景 [英] Android L is ignoring shapes as drawable background
本文介绍了Android的L被忽略形状,绘制背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我对我的Nexus 5,测试的Android大号preVIEW我有问题,我的应用程序。
I'm testing Android L Preview on my Nexus 5. I've got problem with my app.
我有一些TextViews背景设定:
I've got some TextViews with background set:
android:background="@drawable/rounded_textview"
和rounded_textview只是形状。这是工作低于大<。= API19
And "rounded_textview" is just shape. It is working great below <=API19.
<?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:bottomRightRadius="2dp"
android:bottomLeftRadius="2dp"
android:topLeftRadius="2dp"
android:topRightRadius="2dp"/>
</shape>
在Android的大号开发preVIEW背景被忽略。我所有的TextViews是透明的。 知不知道我做错了?
On Android L Developer Preview background is ignored. All my TextViews are transparent. Any idea what am I doing wrong?
推荐答案
我发现,包装形状的选择和项目的标签使工作
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>
这篇关于Android的L被忽略形状,绘制背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文