TabLayout 中各个 tab 布局一致,怎么解决控件的复用问题
发布网友
发布时间:2023-09-20 09:35
我来回答
共1个回答
热心网友
时间:2023-09-23 10:54
用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);