布局文件
<LinearLayout 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:background="@android:color/white" android:orientation="vertical" >
<RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <EditText android:id="@+id/bookname" android:layout_width="fill_parent" android:layout_height="50dp" android:layout_alignBottom="@+id/btn" android:layout_marginRight="70dp" android:background="@android:color/white" android:ems="10" android:hint="enter new note" android:textColorHint="#238745" /> <Button android:id="@+id/btn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/btn" android:text="add" android:layout_alignParentTop="true" android:layout_alignParentRight="true" /> </RelativeLayout> <ListView android:id="@+id/bookslist" android:layout_width="match_parent" android:layout_height="wrap_content" > </ListView>
</LinearLayout>
原文:http://www.cnblogs.com/wenxz0060/p/4463536.html