ViewPager 未显示在 BottomSheetDialog 上。这是实现。
public void show(final BoxItem boxItem) {
bottomSheet = (mContext).getLayoutInflater().inflate(R.layout.layout_change_size_and_frequency, null);
bottomSheetDialog.setContentView(bottomSheet);
bottomSheetDialog.show();
hashMap = boxItem.getFrequencyItemConfigHashMap();
initViews();
setupViewPagerAndTabs();
}
private void setupViewPagerAndTabs() {
Set<String> keySet = hashMap.keySet();
ViewPagerAdapter adapter = new ViewPagerAdapter(((AppCompatActivity) mContext).getSupportFragmentManager());
for (String key : keySet) {
adapter.addFragment(SearchDetailItemsFragment.getInstance(hash.get(key)), key);
}
viewPager.setAdapter(adapter);
tabLayout.setupWithViewPager(viewPager);
}
private void initViews() {
tabLayout = (TabLayout) bottomSheet.findViewById(R.id.tabs);
viewPager = (ViewPager) bottomSheet.findViewById(R.id.viewPager);
}