android的状态栏文字和图标都默认为白色的, 但是有些UI沉浸成白色的,就看不清楚状态栏文字。
在onCreate()设置:
StatusBarFontHelper.setStatusBarMode(this, true);
package com.ikuaibaike.qishou.kuaibaike.shopmall.activity;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.ikuaibaike.qishou.kuaibaike.R;
import com.ikuaibaike.qishou.kuaibaike.common.activity.BaseActivity;
import com.ikuaibaike.qishou.kuaibaike.common.view.CircleIndicator;
import com.ikuaibaike.qishou.kuaibaike.common.view.statusbar.StatusBarFontHelper;
import com.ikuaibaike.qishou.kuaibaike.shopmall.MyPagerAdapter;
import com.ikuaibaike.qishou.kuaibaike.utils.Util;
import java.util.ArrayList;
import java.util.List;
import butterknife.Bind;
import butterknife.OnClick;
public class ShoppingDetailActivity extends BaseActivity {
@Bind(R.id.iv_back)
ImageView ivBack;
@Bind(R.id.mViewpager)
ViewPager mViewpager;
@Bind(R.id.item_circleindicator)
CircleIndicator itemCircleindicator;
@Bind(R.id.ll_vp)
LinearLayout llVp;
@Bind(R.id.tv_top)
TextView tvTop;
@Bind(R.id.ll_buy)
LinearLayout llBuy;
@Override
protected void initPresenter() {
}
@Override
protected void initView() {
//设置标题栏字体为黑色
StatusBarFontHelper.setStatusBarMode(this, true);
//隐藏状态栏
Util.hideStatusLan(this);
setBanner();
}
@Override
protected int getLayoutViewId() {
return R.layout.activity_shopping_detail;
}
@OnClick({R.id.iv_back,R.id.bt_buy})
public void onClick(View view) {
switch (view.getId()) {
case R.id.iv_back:
finish();
break;
case R.id.bt_buy://购买
Util.startActivity(SubmitOrderActivity.class,null);
break;
}
}
private void setBanner() {
llVp.setVisibility(View.VISIBLE);
List<String> list = new ArrayList<>();
list.add("http://img002.21cnimg.com/photos/album/20160326/m600/B920004B5414AE4C7D6F2BAB2966491E.jpeg");
list.add("http://d.hiphotos.baidu.com/lvpics/h=800/sign=9931b79f1dd5ad6eb5f969eab1ca39a3/a8773912b31bb051b3333f73307adab44aede052.jpg");
list.add("http://d.hiphotos.baidu.com/zhidao/pic/item/3b87e950352ac65c1b6a0042f9f2b21193138a97.jpg");
if (mViewpager.getAdapter() == null) {
List viewList = new ArrayList<>();
for (int i = 0; i < 3; i++) {
View view = LayoutInflater.from(this).inflate(R.layout.item_recyclerview_item_image, mViewpager, false);
viewList.add(view);
}
mViewpager.setAdapter(new MyPagerAdapter(this, viewList, list));
itemCircleindicator.setViewPager(mViewpager);
}
}
@Override
protected String[] getNeedPermissions() {
return new String[0];
}
@Override
protected void permissionGrantedSuccess() {
}
@Override
protected void permissionGrantedFail() {
}
}
额,模拟器显示不出来,还是白色。。。。