Reputation: 77646
I have a seelctor that I use on my radioButtons. I need to set a border on each one. Why does the selector below not apply border?
<selector xmlns:android="http://schemas.android.com/apk/res/android"
android:exitFadeDuration="@integer/short_anim_time">
<item android:drawable="@color/orange"
android:state_pressed="true"/>
<item android:drawable="@color/orange"
android:state_checked="true"/>
<item android:drawable="@color/white"
android:state_focused="true"/>
<item android:drawable="@color/white"/>
<item>
<shape>
<stroke
android:width="2dp"
android:color="@color/orange"/>
<padding
android:left="@dimen/gap"
android:top="@dimen/gap"
android:right="@dimen/gap"
android:bottom="@dimen/gap"/>
</shape>
</item>
</selector>
Upvotes: 1
Views: 1841
Reputation: 1570
Simple,
put your border in it's own file.
then add
android:background="@drawable/border"
That's how I got it to work with my image views..
<ImageView
android:id="@+id/iv_icon"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_gravity="center_vertical"
android:background="@drawable/border"
android:src="@drawable/foo" />
Upvotes: 1