TabLayout 中各个 tab 布局一致,怎么解决控件的复用问题
1个回答
2016-09-23 · 知道合伙人软件行家
关注
展开全部
用TabLayout+ViewPager+Fragment解决
列表封装到Fragment中
frameLayouts.add(frameLayout2);
FrameLayout frameLayout3 = (FrameLayout) getLayoutInflater().inflate(R.layout.fragment_my, null);
kuwoAdapter3 = new SimpleAdapter(MainActivity.this, list3, R.layout.listview_item, new String[]{"id", "name", "artist"}, new int[]{R.id.txtMusicId, R.id.txtMusicName, R.id.txtMusicArtist});
((ListView) frameLayout3.findViewById(R.id.lvShow)).setAdapter(kuwoAdapter3);
((ListView) frameLayout3.findViewById(R.id.lvShow)).setOnItemClickListener(onItemClickListener);
swipeRefreshLayout3 = setSwipeRefreshLayout((SwipeRefreshLayout) frameLayout3.findViewById(R.id.swipeLayout));
getDate(3);
frameLayouts.add(frameLayout3);
列表封装到Fragment中
frameLayouts.add(frameLayout2);
FrameLayout frameLayout3 = (FrameLayout) getLayoutInflater().inflate(R.layout.fragment_my, null);
kuwoAdapter3 = new SimpleAdapter(MainActivity.this, list3, R.layout.listview_item, new String[]{"id", "name", "artist"}, new int[]{R.id.txtMusicId, R.id.txtMusicName, R.id.txtMusicArtist});
((ListView) frameLayout3.findViewById(R.id.lvShow)).setAdapter(kuwoAdapter3);
((ListView) frameLayout3.findViewById(R.id.lvShow)).setOnItemClickListener(onItemClickListener);
swipeRefreshLayout3 = setSwipeRefreshLayout((SwipeRefreshLayout) frameLayout3.findViewById(R.id.swipeLayout));
getDate(3);
frameLayouts.add(frameLayout3);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询