活动:
public class PrevIEwsFragment extends Fragment {private VIEwPager mPager;@OverrIDepublic VIEw onCreateVIEw(LayoutInflater inflater, VIEwGroup container, Bundle savedInstanceState) { VIEwGroup root = (VIEwGroup) inflater.inflate(R.layout.section_all_icons, container, false); Actionbar toolbar = ((AppCompatActivity) getActivity()).getSupportActionbar(); if (toolbar != null) toolbar.setTitle(R.string.section_two); mPager = (VIEwPager) root.findVIEwByID(R.ID.pager); mPager.setAdapter(new MyPagerAdapter(getActivity().getSupportFragmentManager())); TabLayout mTabs = (TabLayout) layout.findVIEwByID(R.ID.tabs); //layout: qualifIEr must be an Expression. mTabs.setupWithVIEwPager(mPager); mTabs.setTabTextcolors(getResources().getcolor(R.color.semitransparent_white), getResources().getcolor(androID.R.color.white)); mTabs.setSelectedTabIndicatorcolor(getResources().getcolor(R.color.accent)); mTabs.setonTabSelectedListener(new TabLayout.OnTabSelectedListener() { @OverrIDe public voID onTabSelected(TabLayout.Tab tab) { mPager.setCurrentItem(tab.getposition()); } @OverrIDe public voID onTabUnselected(TabLayout.Tab tab) { } @OverrIDe public voID onTabReselected(TabLayout.Tab tab) { } }); return root;}@OverrIDepublic voID onResume() { super.onResume(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LolliPOP) { Toolbar appbar = (Toolbar) getActivity().findVIEwByID(R.ID.toolbar); appbar.setElevation(0); }}@OverrIDepublic voID onPause() { super.onPause(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LolliPOP) { Toolbar appbar = (Toolbar) getActivity().findVIEwByID(R.ID.toolbar); appbar.setElevation((int) getResources().getDimension(R.dimen.toolbar_elevation)); }}class MyPagerAdapter extends FragmentStatePagerAdapter { final String[] tabs; public MyPagerAdapter(androID.support.v4.app.FragmentManager fm) { super(fm); tabs = getResources().getStringArray(R.array.tabs); } @OverrIDe public Fragment getItem(int position) { Fragment f = new Fragment(); switch (position) { case 0: f = IconsFragment.newInstance(R.array.latest); break; case 1: f = IconsFragment.newInstance(R.array.system); break; case 2: f = IconsFragment.newInstance(R.array.@R_404_5561@); break; case 3: f = IconsFragment.newInstance(R.array.games); break; case 4: f = IconsFragment.newInstance(R.array.icon_pack); break; case 5: f = IconsFragment.newInstance(R.array.drawer); break; } return f; } @OverrIDe public CharSequence getPageTitle(int position) { return tabs[position]; } @OverrIDe public int getCount() { return tabs.length; }}
我有TabLayout mTabs =(TabLayout)layout.findVIEwByID(R.ID.tabs)的问题;因为布局不被视为限定符.我试图做些什么,但它仍然不起作用.
谢谢.
解决方法:
限定符必须是表达式
***Appears when you skipped something in the root of the path. Exemple:***
(错误):package.method(没有类)
(好的例子:) package.class.method **
总结以上是内存溢出为你收集整理的java – 错误:“限定符必须是表达式” – Android Studio全部内容,希望文章能够帮你解决java – 错误:“限定符必须是表达式” – Android Studio所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)