<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"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.app.MainActivity$PlaceholderFragment" >
<ListView
android:id="@+id/listOfLists"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/button1"
android:layout_alignParentLeft="true"
android:layout_below="@+id/button" />
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@id/listView1"
android:layout_alignParentTop="true"
android:layout_alignRight="@+id/listView1"
android:onClick="NewListActivity"
android:text="New List v2" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/listView1"
android:layout_alignParentBottom="true"
android:layout_alignRight="@+id/listView1"
android:text="Receipts"
android:onClick="ReceiptsActivity" />
</RelativeLayout>
我收到错误说
Multiple annotations found at this line:
- The id "listView" is not defined anywhere. Did you mean one of {listView1, listView2} ?
- error: Error: No resource found that matches the given name (at 'layout_alignEnd' with value '@id/
我没有使用listView,我正在使用listView1。
答案 0 :(得分:1)
更改此
android:layout_alignEnd="@id/listView1"
到
android:layout_alignEnd="@id/listOfLists"
因为你有
<ListView
android:id="@+id/listOfLists"
同样在@+id/listOfLists
编辑:
使用
<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"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.app.MainActivity$PlaceholderFragment" >
<ListView
android:id="@+id/listOfLists"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/button1"
android:layout_alignParentLeft="true"
android:layout_below="@+id/button" />
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@id/listOfLists"
android:layout_alignParentTop="true"
android:layout_alignRight="@id/listOfLists"
android:onClick="NewListActivity"
android:text="New List v2" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@id/listOfLists"
android:layout_alignParentBottom="true"
android:layout_alignRight="@id/listOfLists"
android:text="Receipts"
android:onClick="ReceiptsActivity" />
</RelativeLayout>