Tab下的button和ListView都没反应

hshm20517 2010-07-27 06:21:03
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))


...全文
594 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
fighter 2010-11-18
  • 打赏
  • 举报
回复
mark
「已注销」 2010-10-29
  • 打赏
  • 举报
回复
标记。。。。。
iichuang 2010-07-27
  • 打赏
  • 举报
回复
初学者,还不太懂,再等等,会有高手来的

80,351

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧