我实现了一个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>
贴个我的布局文件
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>
解决方案 »
- 从assets中读取的文件转化成了Bitmap,Canvas绘制时报空指针。代码.....
- 求一个android读取sd卡上xml的例子
- 如何用微博账号登陆自己开发的应用
- 急!急!!急!!!android edittext 当软键盘开启时,如何监听KeyEvent.KEYCODE_BACK按键?
- 播放rtsp媒体,如何让mediaplayer pause rtsp
- android简单问题大家都看看(重谢)
- 求GoogleAndroidSDK开发范例大全源码 pdf 和 OPhone应用开发权威指南 pdf 下载
- android发送短信问题
- actionbar的TabListener中onTabSelected方法是如何用fragment替换activity中的view的?
- 谁有Android SDK Build Tools revision 19.1.0?
- 有没有谁遇到过,手机自动弹出挂载,再弹。。。
- 2M到5M图片(jgp格式)如何旋转,保存?
<?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>