Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/202.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android LinearLayout未设置所需的布局高度属性_Android_Styles_Themes_Android Linearlayout - Fatal编程技术网

Android LinearLayout未设置所需的布局高度属性

Android LinearLayout未设置所需的布局高度属性,android,styles,themes,android-linearlayout,Android,Styles,Themes,Android Linearlayout,我正在做一个布局并应用一些样式。因此: <style name="LayoutSmallMap"> <item name="android:layout_width">fill_parent</item> <item name="android:layout_height">180dip</item> <item name="android:background">@drawa

我正在做一个布局并应用一些样式。因此:

<style name="LayoutSmallMap">
        <item name="android:layout_width">fill_parent</item>
        <item name="android:layout_height">180dip</item>
        <item name="android:background">@drawable/rounded_corner</item>
        <item name="android:layout_margin">5dip</item>
        <item name="android:padding">3dip</item>
</style>

填补家长的空缺
180度
@可拉伸/圆角
5dip
3dip
我用这个:

<LinearLayout 
       style="@style/LayoutSmallMap">

</LinearLayout>

但当我在手机出现错误之前测试手机时,现在显示:

LinearLayout未设置所需的布局高度属性

他找不到我的风格

不知道这是否是最好的解决方案,但它对我有效: 目标SDK:2.3和 minSdkVersion=“7”

试试这个

<style name="LayoutSmallMap">         
    <item name="android:background">@drawable/rounded_corner</item>
    <item name="android:layout_margin">5dip</item>
    <item name="android:padding">3dip</item>
</style>

@可拉伸/圆角
5dip
3dip
布局

<LinearLayout 
    android:layout_width="fill_parent"
   android:layout_height="180dib"
    style="@style/LayoutSmallMap">

 </LinearLayout>

在样式中不应使用android:layout\u width和android:layout\u height。 按如下方式修改代码

<style name="LayoutSmallMap">
        <item name="android:background">@drawable/rounded_corner</item>
        <item name="android:layout_margin">5dip</item>
        <item name="android:padding">3dip</item>
</style>


<LinearLayout 
       android:layout_width="fill_parent" 
       android:layout_height="180dip"  
       style="@style/LayoutSmallMap">

</LinearLayout>

@可拉伸/圆角
5dip
3dip

我已经这样做了,这解决了我的问题,但我希望它是所有风格的东西,因此布局的源代码将更美观,便于可视化。Thanks@AderbalNunes如何接受这个答案我们只想在这个布局中没有高度
android:layout\u width=“fill\u parent”
android:layout\u width=“180dip”
这是可能的..是线性布局所必需的,不能只使用样式。
android:layout\u width=“fill\u parent”
android:layout\u width=“180dip”