0
我有我的應用程序佈局,我定義爲:設置的激活狀態形狀的Android
<LinearLayout
android:id="@+id/amountLayout"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_weight="0.25"
android:background="@drawable/gradient_effect_green"
android:orientation="vertical"
android:padding="10dp"
android:layout_marginLeft="3dp"
android:layout_marginRight="3dp"
android:layout_marginBottom="3dp" >
和gradient_effect_green
是:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<
<solid android:color="@color/green_light" />
<corners
android:bottomLeftRadius="20dp"
android:bottomRightRadius="20dp"
android:topLeftRadius="20dp"
android:topRightRadius="20dp" /></shape>
一切工作就像一個魅力。現在我想在這個佈局上設置監聽器,並且我想爲這個佈局定義激活狀態,但我不知道如何。通過激活狀態,我的意思是例如當用戶觸摸這個佈局時改變背景顏色。事情是這樣的:
android:state_pressed="true" android:drawable="@color/deep_light"
你是我的英雄! – A23149577 2014-10-11 06:26:17
感謝您的讚揚 – 2014-10-11 06:27:08