date:2021-10-10 16:33:37
update:更新沉浸状态栏
This commit is contained in:
@@ -362,6 +362,8 @@ dependencies {
|
||||
implementation 'com.trello.rxlifecycle2:rxlifecycle-android:2.2.2'
|
||||
implementation 'com.trello.rxlifecycle2:rxlifecycle-components:2.2.2'
|
||||
//状态栏透明
|
||||
implementation 'com.gitee.zackratos:UltimateBarX:0.7.1'
|
||||
|
||||
// 基础依赖包,必须要依赖
|
||||
implementation 'com.gyf.immersionbar:immersionbar:3.0.0'
|
||||
// fragment快速实现(可选)
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.mjsheng.myappstore.utils.SPUtils;
|
||||
import com.mjsheng.myappstore.utils.ServiceAliveUtils;
|
||||
import com.mjsheng.myappstore.utils.StatusBarUtil;
|
||||
import com.mjsheng.myappstore.utils.Utils;
|
||||
import com.zackratos.ultimatebarx.ultimatebarx.java.UltimateBarX;
|
||||
|
||||
import cn.jpush.android.api.JPushInterface;
|
||||
|
||||
@@ -41,6 +42,16 @@ public class HomeActivity extends AppCompatActivity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
StatusBarUtil.init(this);
|
||||
UltimateBarX.statusBar(this)
|
||||
.transparent()
|
||||
.colorRes(R.color.colorPrimaryDark)
|
||||
.light(true)
|
||||
.apply();
|
||||
UltimateBarX.navigationBar(this)
|
||||
.transparent()
|
||||
.colorRes(R.color.colorPrimaryDark)
|
||||
.light(true)
|
||||
.apply();
|
||||
setContentView(R.layout.activity_home);
|
||||
if (BuildConfig.DEBUG) {
|
||||
bt_log = findViewById(R.id.bt_log);
|
||||
|
||||
@@ -7,14 +7,27 @@ import android.view.View;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.gyf.immersionbar.ImmersionBar;
|
||||
import com.mjsheng.myappstore.R;
|
||||
import com.mjsheng.myappstore.utils.StatusBarUtil;
|
||||
import com.trello.rxlifecycle2.components.support.RxAppCompatActivity;
|
||||
import com.zackratos.ultimatebarx.ultimatebarx.java.UltimateBarX;
|
||||
|
||||
public abstract class BaseActivity extends RxAppCompatActivity {
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
StatusBarUtil.init(this);
|
||||
// StatusBarUtil.init(this);
|
||||
UltimateBarX.statusBar(this)
|
||||
.transparent()
|
||||
.colorRes(R.color.colorPrimaryDark)
|
||||
.light(true)
|
||||
.apply();
|
||||
UltimateBarX.navigationBar(this)
|
||||
.transparent()
|
||||
.colorRes(R.color.colorPrimaryDark)
|
||||
.light(true)
|
||||
.apply();
|
||||
//状态栏改变放在setContentView前后有所不同
|
||||
setContentView(this.getLayoutId());
|
||||
initView();
|
||||
initData();
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context="com.mjsheng.myappstore.activity.HomeActivity">
|
||||
|
||||
<ImageView
|
||||
@@ -36,6 +37,7 @@
|
||||
app:layout_constraintEnd_toEndOf="@+id/bt_log"
|
||||
app:layout_constraintStart_toStartOf="@+id/bt_log"
|
||||
app:layout_constraintTop_toBottomOf="@+id/bt_log" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView3"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#ffffff"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context=".activity.MainActivity">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
@@ -165,8 +166,7 @@
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/imageView2"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
/>
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_devsn"
|
||||
@@ -240,8 +240,8 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="班级"
|
||||
android:layout_marginStart="16dp"
|
||||
android:text="班级"
|
||||
android:textColor="#000000"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@@ -281,8 +281,8 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="学号"
|
||||
android:layout_marginStart="16dp"
|
||||
android:text="学号"
|
||||
android:textColor="#000000"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@@ -322,8 +322,8 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="姓名"
|
||||
android:layout_marginStart="16dp"
|
||||
android:text="姓名"
|
||||
android:textColor="#000000"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@@ -363,8 +363,8 @@
|
||||
android:id="@+id/textView4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="版本"
|
||||
android:layout_marginStart="16dp"
|
||||
android:text="版本"
|
||||
android:textColor="#000000"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context="com.mjsheng.myappstore.activity.HomeActivity">
|
||||
|
||||
<ImageView
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#ffffff"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context=".activity.MainActivity">
|
||||
|
||||
|
||||
@@ -21,8 +22,8 @@
|
||||
android:id="@+id/back"
|
||||
android:layout_width="@dimen/dp_16"
|
||||
android:layout_height="@dimen/dp_16"
|
||||
android:adjustViewBounds="true"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/back"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@@ -136,8 +137,7 @@
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/imageView2"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
/>
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_devsn"
|
||||
@@ -211,8 +211,8 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="班级"
|
||||
android:layout_marginStart="16dp"
|
||||
android:text="班级"
|
||||
android:textColor="#000000"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@@ -252,8 +252,8 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="学号"
|
||||
android:layout_marginStart="16dp"
|
||||
android:text="学号"
|
||||
android:textColor="#000000"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@@ -293,8 +293,8 @@
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="姓名"
|
||||
android:layout_marginStart="16dp"
|
||||
android:text="姓名"
|
||||
android:textColor="#000000"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@@ -334,8 +334,8 @@
|
||||
android:id="@+id/textView4"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="版本"
|
||||
android:layout_marginStart="16dp"
|
||||
android:text="版本"
|
||||
android:textColor="#000000"
|
||||
android:textSize="@dimen/sp_12"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@@ -355,7 +355,6 @@
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
@@ -377,9 +376,9 @@
|
||||
<TextView
|
||||
android:id="@+id/tv_customversion"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="10dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/background_top"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#3F51B5</color>
|
||||
<color name="colorPrimaryDark">#303F9F</color>
|
||||
<color name="colorAccent">#FF4081</color>
|
||||
<color name="colorPrimary">#FFFFFF</color>
|
||||
<color name="colorPrimaryDark">#FFFFFF</color>
|
||||
<color name="colorAccent">#FFFFFF</color>
|
||||
<!-- <color name="colorPrimary">#3F51B5</color>-->
|
||||
<!-- <color name="colorPrimaryDark">#303F9F</color>-->
|
||||
<!-- <color name="colorAccent">#FF4081</color>-->
|
||||
<color name="textColor">#ff797979</color>
|
||||
<color name="topcolor">#878686</color>
|
||||
<color name="white">#ffffff</color>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
<item name="android:windowBackground">@color/colorPrimary</item>
|
||||
</style>
|
||||
|
||||
<style name="password_dialog_style">
|
||||
|
||||
Reference in New Issue
Block a user