开发者

TabHost - get selector to work for inner child of tab view?

I have a TabHost, and each of my tabs are individual views which look like:

<LinearLayout orientation="vertical">
  <ImageView />
  <TextView />
</LinearLayout>

I can set a selector on the parent LinearLayout so that when the user touches the tab, its background changes, but the child ImageView (with the same selector pattern) does not get its state changed. Trying the following:

<item 
  android:state_focused="true" 
  android:state_pressed="true" 
  android:drawable="@drawable/plz_hilite_me" />

This works for the final focus state of the tab, both the parent LinearLayout and the child ImageView have the hilited backgrounds specified in the selector displayed. It's just the initial touch state which doesn't seem to get triggered for the inner开发者_开发百科 child.

Hard to explain, hope that makes sense, thanks!


Using:

android:duplicateParentState="true"

worked.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜