2014-03-02 77 views
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" 
    /> 

回答

6

這是android:layout_weight="1"

+0

謝謝!另一個問題,如果你不介意?爲什麼'EditText'不出現?然而,按鈕和文本視圖顯示。 –

+1

layout_weight只適用於LinearLayout。這是一個RelativeLayout,所以如果你指定高度或寬度0dp,那就是你將得到的實際大小,並且權重將被忽略 – SDJMcHattie

相關問題