java代码:
=======================
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// final Button name_sort=(Button)findViewById(R.id.name_sort);???
mData =getData();
SimpleAdapter adapter = new SimpleAdapter(this,getData(),R.layout.select,new String[]{"name","phone","address"},new int[]{R.id.name,R.id.phone,R.id.address});
setListAdapter(adapter);
=====================================================
select.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableLayout android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="3">
<TableRow>
<TextView android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<TextView android:id="@+id/phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<TextView android:id="@+id/address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"/>
</TableRow>
</TableLayout>
</LinearLayout>
============================================================
我现在想要在ListView这个视图下面追加一个返回按钮,但是我在select.xml添加了按钮布局,显示出来好几个返回按钮,我是初学者,请问是不是要重新建立一个xml文件啊,请高手帮忙。应该怎样做
=======================
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// final Button name_sort=(Button)findViewById(R.id.name_sort);???
mData =getData();
SimpleAdapter adapter = new SimpleAdapter(this,getData(),R.layout.select,new String[]{"name","phone","address"},new int[]{R.id.name,R.id.phone,R.id.address});
setListAdapter(adapter);
=====================================================
select.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TableLayout android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="3">
<TableRow>
<TextView android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<TextView android:id="@+id/phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<TextView android:id="@+id/address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"/>
</TableRow>
</TableLayout>
</LinearLayout>
============================================================
我现在想要在ListView这个视图下面追加一个返回按钮,但是我在select.xml添加了按钮布局,显示出来好几个返回按钮,我是初学者,请问是不是要重新建立一个xml文件啊,请高手帮忙。应该怎样做
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货