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