fragment显示了一个listview,怎么使其点击有效
推荐于2016-06-30 · 知道合伙人数码行家
huanglenzhi
知道合伙人数码行家
向TA提问 私信TA
知道合伙人数码行家
采纳数:117538
获赞数:517198
长期从事计算机组装,维护,网络组建及管理。对计算机硬件、操作系统安装、典型网络设备具有详细认知。
向TA提问 私信TA
关注
展开全部
主activity是这样
[mw_shl_code=java,true]public class MainTabHostActivity extends FragmentActivity{
private FragmentTabHost mTabHost;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_layout);
mTabHost = (FragmentTabHost)findViewById(android.R.id.tabhost);
mTabHost.setup(this, getSupportFragmentManager(), R.id.realtabcontent);
mTabHost.addTab(mTabHost.newTabSpec("tab1").setIndicator("软件"),SoftwareFragment.class,null);
mTabHost.addTab(mTabHost.newTabSpec("tab2").setIndicator("日志"),SoftwareFragment.class,null);
mTabHost.addTab(mTabHost.newTabSpec("tab3").setIndicator("权限"),SoftwareFragment.class,null);
mTabHost.addTab(mTabHost.newTabSpec("tab3").setIndicator("设置"),SoftwareFragment.class,null);
}
}[/mw_shl_code]
在onCreateView里面少了句:softwareListView.setOnItemClickListener(this);吧亲
[mw_shl_code=java,true]public class MainTabHostActivity extends FragmentActivity{
private FragmentTabHost mTabHost;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_layout);
mTabHost = (FragmentTabHost)findViewById(android.R.id.tabhost);
mTabHost.setup(this, getSupportFragmentManager(), R.id.realtabcontent);
mTabHost.addTab(mTabHost.newTabSpec("tab1").setIndicator("软件"),SoftwareFragment.class,null);
mTabHost.addTab(mTabHost.newTabSpec("tab2").setIndicator("日志"),SoftwareFragment.class,null);
mTabHost.addTab(mTabHost.newTabSpec("tab3").setIndicator("权限"),SoftwareFragment.class,null);
mTabHost.addTab(mTabHost.newTabSpec("tab3").setIndicator("设置"),SoftwareFragment.class,null);
}
}[/mw_shl_code]
在onCreateView里面少了句:softwareListView.setOnItemClickListener(this);吧亲
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询