LinearLayout有样式而没有方向问题?

时间:2013-12-02 11:19:38

标签: android android-linearlayout android-styles

我有LinearLayout的样式:

<style name="clickable_zone">
    <item name="android:layout_height">match_parent</item>
    <item name="android:layout_width">match_parent</item>
    <item name="android:id">@+id/click_zone</item>
    <item name="android:background">@drawable/simple_button_holo</item>
    <item name="android:orientation">horizontal</item>
</style>

我在不同的布局中使用这种风格:

<LinearLayout
        style="@style/clickable_zone" />

但在这种情况下,我会收到有关方向问题的警告。当然,我可以禁用此警告。但是,我可以在不禁用警告的情况下解决我的问题吗?

UPD1。问题消息:

Checks that LinearLayouts with multiple children set the orientation

The default orientation of a LinearLayout is horizontal. It's pretty easy to believe that the layout is vertical, add multiple children to it, and wonder why only the first child is visible (when the subsequent children are off screen to the right). This lint rule helps pinpoint this issue by warning whenever a LinearLayout is used with an implicit orientation and multiple children.

It also checks for empty LinearLayouts without an orientation attribute that also defines an id attribute. This catches the scenarios where children will be added to the LinearLayout dynamically.

0 个答案:

没有答案