【问题标题】:error: Error: Integer types not allowed (at 'layout_height' with value '10')错误:错误:不允许使用整数类型(在“layout_height”处,值为“10”)
【发布时间】:2015-03-05 07:58:17
【问题描述】:
<TextView
    android:id="@+id/textView1"
    android:layout_width="match_parent"
    android:layout_height="10"
    android:layout_alignBottom="@+id/editText2"
    android:layout_alignRight="@+id/editText2"
    android:layout_alignEnd="@+id/editText2"
    android:layout_marginBottom="63dp"
    android:text="@string/hello" />

每次我输入没有字符串的文本时,它都会给我一个黄色的我签名。所以我做了一个字符串。现在我在 layout_height 收到上述消息。我是安卓开发新手。

【问题讨论】:

    标签: android types integer


    【解决方案1】:

    使用 dp 或 sp 指定整数值

     android:layout_height="10dp"
    

     android:layout_height="35sp"
    

    【讨论】:

      【解决方案2】:

      你应该在 dp 中指定高度。

      身高和体重属性是基于单位的。你不能简单地添加整数。

      android:layout_height="10dp"
      

      也检查这些链接

      What is the difference between "px", "dp", "dip" and "sp" on Android?

      http://developer.android.com/guide/topics/resources/more-resources.html#Dimension

      What's the difference between fill_parent and wrap_content?

      【讨论】:

        猜你喜欢
        • 2016-05-17
        • 1970-01-01
        • 1970-01-01
        • 2015-01-18
        • 2017-04-03
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-12-10
        相关资源
        最近更新 更多