Axa*_*dax 28 eclipse android adt android-layout
如果我有很多TextViews作为项目标签,我想我可以将所有关于它们的常见内容提取到样式中,并且在布局中仅使用
<TextView style="@style/label" android:text="Foo"/>
<TextView style="@style/label" android:text="Bar"/>
Run Code Online (Sandbox Code Playgroud)
风格如:
<style name="label">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
</style>
Run Code Online (Sandbox Code Playgroud)
但是,当我这样做时,它在模拟器和设备上工作正常,但Android XML编辑器抱怨说"<TextView>" does not set the required layout_height attribute.
,为什么它报告此警告有什么原因?
Yoa*_*uet 10
你有没有试过清理这个项目?
我在一些XML文件中也使用相同的宽度和长度.这是一个在我的应用程序上工作的示例,你可以看看:
<TextView
android:id="@+id/viewdescription"
android:textIsSelectable="true"
android:layout_below="@+id/rating_bar_view"
android:minLines="8"
style="@style/description" />
Run Code Online (Sandbox Code Playgroud)
和XML:
<style name="description">
<item name="android:layout_gravity">center_horizontal</item>
<item name="android:inputType">textMultiLine</item>
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textSize">14sp</item>
<item name="android:textColor">@color/Black</item>
<item name="android:layout_marginRight">8dp</item>
<item name="android:layout_marginLeft">8dp</item>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
14848 次 |
| 最近记录: |