你必须在第7行提供layout_width属性

时间:2012-08-04 06:01:29

标签: android xml

I have been trying to run this code but getting this error since last 1 week.

请帮忙! 我已经声明了layout:width。 在滑动抽屉中尝试layout.width并替换dp wit dip但仍然遇到相同的错误。

<?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_height="fill_parent"
        android:layout_width="fill_parent"> 

       <SlidingDrawer
           android:id="@+id/drawer"
           android:width="320dp"
           android:height="440dp"
           android:orientation="vertical"
           android:content="@+id/content"
           android:handle="@+id/handle">

           <ImageView 
               android:id="@+id/handle"
               android:layout_width="48dp"
               android:layout_height="48dp"
               android:src="@drawable/ic_launcher"/>

           <AnalogClock 
               android:id="@+id/content"
               android:background="#D0A0A0"
               android:layout_width="fill_parent"
               android:layout_height="fill_parent"/>
       </SlidingDrawer>
        </RelativeLayout>

1 个答案:

答案 0 :(得分:1)

我认为布局标签是强制性标签。您尚未向SlidingDrawer

提供layout_width和layout_height
android:layout_width="fill_parent"
android:layout_height="fill_parent"