Tab下的button和ListView都没反应
Tab下的button和ListView,当点击button或者ListView都没反应,去调试,程序根本没触发对应的事件。
在网上看一兄弟的解决办法:已经解决了,呵呵,加个listview.setItemsCanFocus(true)就可以了
地址:http://www.eoeandroid.com/thread-24736-1-1.html
我设置了也没用,请高人指点。
代码:
xml代码:
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout android:orientation="vertical"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<TabWidget android:id="@android:id/tabs"
android:layout_width="fill_parent" android:layout_height="60dp" />
<FrameLayout android:id="@android:id/tabcontent"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<RelativeLayout android:orientation="vertical"
android:layout_marginTop="4px" android:id="@+id/content"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<EditText android:id="@+id/number" android:phoneNumber="true"
android:singleLine="true" android:layout_marginRight="60dp"
android:layout_width="fill_parent" android:textSize="24sp"
android:layout_marginTop="8px" android:layout_alignParentLeft="true"
android:layout_height="60dp">
</EditText>
<ImageButton android:id="@+id/deleteNum"
android:layout_width="60dp" android:layout_height="60dp"
android:layout_alignParentTop="true" android:layout_marginTop="8px"
android:layout_alignParentRight="true"
android:src="@drawable/ic_dial_action_delete"
android:layout_toLeftOf="@id/number">
</ImageButton>
<ListView android:id="@+id/contacts" android:layout_width="fill_parent"
android:layout_height="100dp"
android:layout_below="@id/number"
android:focusable="true"
>
</ListView>
</RelativeLayout>
<ListView android:id="@+id/people" android:layout_width="fill_parent"
android:layout_height="fill_parent"><
java代码:
contacts = (ListView) findViewById(R.id.contacts);
mTabHost = getTabHost();
/* 为TabHost添加标签 */
// 新建一个newTabSpec(newTabSpec)
// 设置其标签和图标(setIndicator)
// 设置内容(setContent)
mTabHost.addTab(mTabHost.newTabSpec("phone").setIndicator(
getString(R.string.simoPhone_phone),
getResources().getDrawable(R.drawable.ic_dial_number_wht))
.setContent(R.id.content));
mTabHost.addTab(mTabHost.newTabSpec("sms").setIndicator(
getString(R.string.simoPhone_sms),
getResources().getDrawable(R.drawable.sym_action_email))