怎样的android同时为应用按钮形状和选择形状、按钮、android

由网友(好聚好散.)分享简介:我已经申请形状的按钮,如:I have applied a shape for a button like:我已经申请形状的按钮,如:

I have applied a shape for a button like:

<?xml version="1.0" encoding="utf-8"?>

<shape xmlns:android="http://schemas.android.com/apk/res/android"
       android:shape="rectangle" >
    <gradient android:startColor="#DD000000" android:endColor="#DD2d2d2d"  android:angle="90"></gradient>
    <corners android:radius="15dip"></corners>

</shape>

现在我想用一个选择,如:

Now I want to use a selector like:

<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/active"
      android:state_pressed="true" />
<item android:drawable="@drawable/passive"/>

此按钮也。是否有可能... ???

for this Button as well. Is it possible ...???

推荐答案

使用这种方式:

<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android="http://schemas.android.com/apk/res/android">

<item android:state_pressed="true" >
    <shape>.......</shape>
</item>

。 。 。

. . . .

阅读全文

相关推荐

最新文章