读书人

listview旋钮的位置

发布时间: 2012-09-07 10:38:15 作者: rapoo

listview按钮的位置
我实现了一个listview点击按钮add就新增一行,但是add在下方一直增加的话add会被屏幕覆盖,现在我想将它移动到顶部固定的地方,该如何实现。


贴个我的布局文件
main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >

<ImageView
android:id="@+id/i2"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentRight="true"
android:focusable="false" />

<ImageView
android:id="@+id/i3"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginLeft="1200dp"
android:focusable="false" />

<EditText
android:id="@+id/e1"
android:layout_width="300dp"
android:layout_height="50dp"
android:textColor="#000000"
android:layout_alignParentLeft="true"
android:layout_marginLeft="50dp"
android:background="#eeffee"
/>

<!-- <TextView
android:id="@+id/t2"
android:layout_width="500dp"
android:layout_height="50dp"
android:textCoror="#000000"
android:layout_alignParentLeft="true"
android:layout_marginLeft="50dp"
android:background="#eeffee"

/>-->

</RelativeLayout>
test4.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@drawable/fj"
>




<ListView
android:id="@+id/list_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
</ListView>

<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="新增"
android:layout_marginLeft="30dp"
android:layout_marginTop="10dp"
android:textColor="#000000"
android:background="#eeff00"
>



</Button>



</LinearLayout>


[解决办法]

XML code
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"   android:layout_width="fill_parent"   android:layout_height="fill_parent"   android:orientation="vertical"   android:background="@drawable/fj"    >     <Button   android:id="@+id/button"   android:layout_width="wrap_content"   android:layout_height="wrap_content"   android:text="新增"    android:layout_marginLeft="30dp"   android:layout_marginTop="10dp"   android:textColor="#000000"   android:background="#eeff00"   >            </Button>      <ListView   android:id="@+id/list_view"   android:layout_width="fill_parent"   android:layout_height="fill_parent"   android:layout_weight="1" >   </ListView>        </LinearLayout> 


[解决办法]
直接做自动加载不就完事了

读书人网 >Android

热点推荐