可以覆盖/布局应用样式包括以<包括>标签? [英] Possible to override/apply style in layout included with <include> tag?

查看:100
本文介绍了可以覆盖/布局应用样式包括以<包括>标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我包括在我自己的布局(内部)的布局是这样的:

I am including an (internal) layout in my own layout like this:

<include android:id="@+id/twolinelistitem" 
    layout="@android:layout/simple_list_item_2"
    style="@style/TwoLineListItem"/>

但款式不适用。该<一href="http://android-developers.blogspot.com/2009/02/android-layout-tricks-2-reusing-layouts.html">blog帖子没有提到这应该工作,所以我好,如果它没有。

but the style is not applied. This blog post doesn't mention that this should work so I'm okay if it doesn't.

所以设置IE背景的唯一方法是通过编程?

So the only way to set i.e. the background is programmatically?

下面是一个有点相关 Android的问题

推荐答案

不幸的是,这似乎并不可能。仅布局参数(如果二者的高度和宽度被设定...),id和能见度从传递包括标签的实际布局。对包括标签设置风格似乎并没有产生作用。

Unfortunately, this does not seem to be possible. Only the layout parameters (if both height and width are set...), id, and visibility are passed from the include tag to the actual layout. Setting a style on the include tag does not seem to have an effect.

您可以看到源$ C ​​$ C解析一个包含<一href="http://grep$c$c.com/file/repository.grep$c$c.com/java/ext/com.google.android/android/2.3.3_r1/android/view/LayoutInflater.java#LayoutInflater.parseInclude%28org.xmlpull.v1.XmlPullParser,android.view.View,android.util.AttributeSet%29">here.

You can see the source code for parsing an include here.

这篇关于可以覆盖/布局应用样式包括以&lt;包括&GT;标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆