开发者

Change background of linearlayout on focus in Android?

I have the linearlayout which has the background set as rect.xml as mentioned below. The orientation of this layout is vertical.

 <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> 
<solid android:color="#ffffff"/>    

<stroke android:width="1dp"
        android:color="#bbbbbb"/>

<corners android:radius="10px"/> 
</shape>

There are two other linearlayouts as child of the above linearlayout. What I want is that the child linearlyouts focus should be changed on focus and when pressed. I h开发者_如何转开发ave created one item selector file and added that as the background of the child linearlayouts but that makes the border of the rectangle hidden.

Can anyone let me know how to do this?


Use state list drawable and provide different background.xml

http://developer.android.com/guide/topics/resources/drawable-resource.html#StateList

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜