我有一个这样的状态列表:
<selector xmlns:androID="http://schemas.androID.com/apk/res/androID"> <item androID:state_pressed="true" androID:drawable="@color/dark_green" /> <item androID:drawable="@color/bright_green" /></selector>
<?xml version="1.0" enCoding="utf-8"?><shape xmlns:androID="http://schemas.androID.com/apk/res/androID" androID:shape="rectangle"> <corners androID:bottomrighTradius="7dp" androID:bottomLefTradius="7dp" androID:topLefTradius="7dp" androID:topRighTradius="7dp"/> </shape>
我的问题是如何同时应用两者?如果我将backgroundResource设置为颜色列表,则可以获取颜色,但是无法将其用于形状.我尝试将backgroundResource用作形状,并将backgroundcolor用作颜色,但这没有用.
解决方法:
<selector xmlns:androID="http://schemas.androID.com/apk/res/androID"> <item androID:state_pressed="true" androID:drawable="@color/dark_green" > <shape androID:shape="rectangle"> <corners androID:bottomrighTradius="7dp" androID:bottomLefTradius="7dp" androID:topLefTradius="7dp" androID:topRighTradius="7dp"/> </shape> <item/> <item androID:drawable="@color/bright_green" /></selector>
我已经做过类似your.的事情,但是当您使用draDWalbe时,它不起作用.如果您这样使用(使用实心填充按钮而不使用可绘制对象,可以拖动圆角按钮),则可以使用.
<?xml version="1.0" enCoding="utf-8"?><@R_118_3419@ xmlns:androID="http://schemas.androID.com/apk/res/androID"> <item> <shape androID:shape="rectangle"> <solID androID:color="#FFEC7600" /> <corners androID:topLefTradius="5dip" androID:topRighTradius="5dip" androID:bottomLefTradius="5dip" androID:bottomrighTradius="5dip" /> </shape> </item>
总结 以上是内存溢出为你收集整理的彩色按钮上的状态列表形状?全部内容,希望文章能够帮你解决彩色按钮上的状态列表形状?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)