■やりたいこと
画像をタップしたタイミングで画像を縮小して、タップした感じを表現したい
■できていないこと
以下のようにdrawable/btn_tap.xmlを作成し、
対象のimageViewにsrcで指定していますが、縮小されません
lang
1<?xml version="1.0" encoding="utf-8"?> 2<selector xmlns:android="http://schemas.android.com/apk/res/android"> 3 <!-- Buttonが押された時 --> 4 <item android:drawable="@drawable/login_btn" android:state_pressed="true"> 5 <shape android:shape="rectangle"> 6 <size android:width="30dp" android:height="40dp"/> 7 <!--<solid--> 8 <!--android:color="@color/colorAccent" />--> 9 </shape> 10 </item> 11 12 <!-- Buttonが押されてない時 --> 13 <item android:drawable="@drawable/login_btn" android:state_pressed="false"/> 14 15</selector>
対象のimageViewのxmlは以下です。
lang
1 <LinearLayout 2 android:layout_width="match_parent" 3 android:layout_height="wrap_content" 4 android:orientation="vertical"> 5 <ImageView 6 android:id="@+id/image" 7 android:adjustViewBounds="true" 8 android:layout_width="wrap_content" 9 android:layout_height="@dimen/sample_btn_height" 10 android:src="@drawable/btn_tap" 11 android:contentDescription="@string/sample_btn_desc" /> 12 13 </LinearLayout> 14
お手数ですが、お力添えをお願いいたします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/02/10 19:57
2016/02/11 02:09