Fragment的显示问题

setContentView(R.layout.activity_main);
listView=(MsgListView)findViewById(R.id.matterListtView);

payProductFragment=(PayProductFragment)this.getSupportFragmentManager().findFragmentById(R.id.payProductFragment);
this.getSupportFragmentManager().beginTransaction().hide(payProductFragment).commit();

listView.setOnItemClickListener(new OnItemClickListener()
{
public void onItemClick(AdapterView<?> arg0,View arg1,int index,long arg3)
{
Log.d("TAG","开始处理listView点击事件!!!!!~~~~~");
Product p=listAdapter.getItem(index-1);
payProductFragment.setData(p);
MainActivity.this.getSupportFragmentManager().beginTransaction().setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_right).show(payProductFragment).commit();
}
});

在setContentView方法中载入了activity_mail.xml布局文件,布局文件中只包含一个MsgListView(ListView的继承类),和一个PayProductFragment(Fragment的继承类),这个Fragment是一个详细信息的展示页面,我先让Fragment隐藏,在点击ListView的某个项时,再将该Fragment显示出来。
上面代码基本是参照一个范例写的,但不知道为什么,点击ListView的项后,没有任何反应,Log显示开始处理ListView的点击事件,但fragment页面不会显示出来,哪位大侠能指导一下为什么?
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值