[1.0.1]
[状态栏适配+整体适配]
This commit is contained in:
yangyakun
2023-02-17 11:51:21 +08:00
parent c8ec42c843
commit 28c92d9222
3 changed files with 16 additions and 9 deletions

View File

@@ -40,7 +40,7 @@ class M2StatusBarView @JvmOverloads constructor(
super.onAttachedToWindow()
post {
val params: ViewGroup.LayoutParams = getLayoutParams()
params.height = AutoSizeUtils.dp2px(context,47f)
params.height = AutoSizeUtils.dp2px(context,40f)
layoutParams = params
}
//添加view控制

View File

@@ -9,18 +9,20 @@
android:id="@+id/driving_fragment"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintWidth_percent="0.29"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintHeight_percent="0.290"/>
app:layout_constraintBottom_toTopOf="@+id/hd_map_fragment"
app:layout_constraintLeft_toLeftOf="parent"/>
<!-- 高精地图-->
<FrameLayout
android:id="@+id/hd_map_fragment"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintWidth_percent="0.416"
app:layout_constraintTop_toBottomOf="@+id/driving_fragment"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintHeight_percent="0.418"/>
app:layout_constraintBottom_toTopOf="@+id/video_fragment"
app:layout_constraintLeft_toLeftOf="parent"/>
<!-- 图片或视频广告-->
@@ -29,8 +31,9 @@
android:id="@+id/video_fragment"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintWidth_percent="0.294"
app:layout_constraintTop_toBottomOf="@+id/hd_map_fragment"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintHeight_percent="0.294"/>
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -19,14 +19,18 @@ public class ScreenHelper {
int baseWidth = 2560;
int baseHeight = 1600;
boolean baseOnWidth = true;
if (AppIdentityModeUtils.isM1(FunctionBuildConfig.appIdentityMode) || AppIdentityModeUtils.isM1(FunctionBuildConfig.appIdentityMode)) {
if (AppIdentityModeUtils.isM1(FunctionBuildConfig.appIdentityMode)) {
baseWidth = 1920;
baseHeight = 1080;
} else if (AppIdentityModeUtils.isM2(FunctionBuildConfig.appIdentityMode)) {
baseWidth = 1080;
baseHeight = 1920;
}
AutoSizeConfig.getInstance()
.setBaseOnWidth(false)
.setBaseOnWidth(baseOnWidth)
.setCustomFragment(true)
.setDesignWidthInDp(baseWidth)
.setDesignHeightInDp(baseHeight)