android 菜单栏提示,android Activity 不显示状态栏

6b0200c22e060153b7066461ad4ddd8b.png

咋整都挡着上面的状态栏了,希望可以指明一下哪里有问题。minsdk=5.0.

xmlns:tools="http://schemas.android.com/tools"

xmlns:app="http://schemas.android.com/apk/res-auto"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:fitsSystemWindows="true"

android:orientation="vertical">

android:id="@+id/toolbar1"

android:layout_width="match_parent"

android:layout_height="?attr/actionBarSize"

android:background="?attr/colorPrimary"

app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"

app:popupTheme="@style/AppTheme.PopupOverlay" />

android:layout_width="match_parent" android:layout_height="wrap_content" />

android:layout_width="match_parent" android:layout_height="match_parent"

app:layout_behavior="@string/appbar_scrolling_view_behavior" />

public class TabActivity extends AppCompatActivity  {

private SectionsPagerAdapter mSectionsPagerAdapter;

private ViewPager mViewPager;

private TabLayout tabLayout;

private List mTitles = new ArrayList();

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_tab);

tabLayout = (TabLayout) findViewById(R.id.tabLayout);

mViewPager = (ViewPager) findViewById(R.id.viewPager);

mTitles.add("TAB1");

mTitles.add("TAB2");

mTitles.add("TAB3");

mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager(),mTitles);

mViewPager.setAdapter(mSectionsPagerAdapter);

tabLayout.setupWithViewPager(mViewPager);

}

public static class PlaceholderFragment extends Fragment {

private static final String ARG_SECTION_NUMBER = "section_number";

private static int pos=0;

public PlaceholderFragment() {

}

public static PlaceholderFragment newInstance(int sectionNumber) {

pos = sectionNumber;

PlaceholderFragment fragment = new PlaceholderFragment();

Bundle args = new Bundle();

args.putInt(ARG_SECTION_NUMBER, sectionNumber);

fragment.setArguments(args);

return fragment;

}

@Override

public View onCreateView(LayoutInflater inflater, ViewGroup container,

Bundle savedInstanceState) {

View rootView = inflater.inflate(R.layout.fragment_tab, container, false);

TextView textView = (TextView) rootView.findViewById(R.id.section_label);

textView.setText(getString(R.string.section_format, getArguments().getInt(ARG_SECTION_NUMBER)));

return rootView;

}

}

public class SectionsPagerAdapter extends FragmentPagerAdapter {

private List titles;

public SectionsPagerAdapter(FragmentManager fm,List mTitles) {

super(fm);

}

@Override

public Fragment getItem(int position) {

return PlaceholderFragment.newInstance(position);

}

@Override

public int getCount() {

return titles.size();

}

@Override

public CharSequence getPageTitle(int position) {

return titles.get(position);

}

}

}

xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"

android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin"

android:paddingLeft="@dimen/activity_horizontal_margin"

android:paddingRight="@dimen/activity_horizontal_margin"

android:paddingTop="@dimen/activity_vertical_margin"

tools:context="com.scxn.demo.TabActivity$PlaceholderFragment">

android:layout_height="wrap_content" />

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值