在父类中,因为父类是从LinearLayout扩展而来的,此函数在类HorizontalScrollView中,我该如何解决此问题
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ViewPager viewPager = findViewById(R.id.viewpager);
CategoryAdapter adapter = new CategoryAdapter(getSupportFragmentManager(), this);
viewPager.setAdapter(adapter);
TableLayout tabLayout = findViewById(R.id.tabs);
tabLayout.setupWithViewPager(viewPager);
}
答案 0 :(得分:1)
此处输入简单错误:
TableLayout tabLayout = findViewById(R.id.tabs);
应该是:
TabLayout tabLayout = findViewById(R.id.tabs);