1
当我编译时,我总是收到这个错误:在'android'包中找不到属性'weight'的资源标识符。我怎样才能解决这个问题?代码:包'android'中没有找到属性'weight'的资源标识符?
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<TextView
android:text="@string/enter_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<EditText
android:hint="@string/hint_one"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:weight="1"
/>
<EditText
android:hint="@string/hint_two"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:weight="1"
/>
<Button
android:text="@string/send_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
谢谢!另一个问题,如果你不介意?为什么'EditText'不出现?然而,按钮和文本视图显示。 –
layout_weight只适用于LinearLayout。这是一个RelativeLayout,所以如果你指定高度或宽度0dp,那就是你将得到的实际大小,并且权重将被忽略 – SDJMcHattie