2016-10-18 50 views
-1

我要去建立一個搜索選項卡,我的應用程序,我的佈局代碼是在這裏:當我部署我的應用程序,我得到這個錯誤:必須提供layout_width屬性

<?xml version="1.0" encoding="utf-8"?> 
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent"> 
<LinearLayout > 
    android:layout_height="match_parent" 
    android:layout_width="match_parent" 
    android:orientation="vertical" 
</LinearLayout> 
<EditText 
android:id="@+id/etSearch" 
android:layout_height="wrap_content" 
android:layout_width="match_parent" 
android:background="@drawable/edit_text_style" 
android:hint="Search Friends" 
android:textColor="#0000"/> 
</FrameLayout> 

我Main.axml

<?xml version="1.0" encoding="utf-8"?> 
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent"> 
<LinearLayout > 
    android:layout_height="match_parent" 
    android:layout_width="match_parent" 
    android:orientation="vertical" 
</LinearLayout> 
<EditText 
android:id="@+id/etSearch" 
android:layout_height="wrap_content" 
android:layout_width="match_parent" 
android:background="@drawable/edit_text_style" 
android:hint="Search Friends" 
android:textColor="#0000"/> 
</FrameLayout> 

當我部署我的應用程序我得到這個錯誤: 必須提供layout_width屬性 任何一個能幫助我嗎?

+0

請發佈完整的堆棧跟蹤。順便說一個空的線性佈局是沒用的,你可以刪除它,因爲它沒有ID。你的一個xml對象必須沒有'layout_width'。嘗試在其他人的文件中搜索併發布請將堆棧 –

+0

解決問題時解決了一個空的linearlayout:D – rashid

回答

0

你有LinearLayout這是match_parent並且不會有空間,爲您EditText

相關問題