Modify: 屏幕适配

This commit is contained in:
Quyunshuo
2020-08-29 09:54:59 +08:00
parent 03960ef66c
commit 2e4c78cdd9
5 changed files with 48 additions and 11 deletions

View File

@ -63,7 +63,7 @@ dependencies {
api GitHub.RetrofitConverterGson
api GitHub.Gson
api GitHub.MMKV
// api GitHub.AutoSize
api GitHub.AutoSize
api GitHub.Glide
api GitHub.ARoute
api GitHub.RecyclerViewAdapter

View File

@ -3,6 +3,7 @@ package com.quyunshuo.base
import android.app.Application
import com.alibaba.android.arouter.launcher.ARouter
import com.quyunshuo.base.utils.SpUtils
import me.jessyan.autosize.AutoSizeConfig
/**
* @Author: QuYunShuo
@ -30,5 +31,8 @@ open class BaseApplication : Application() {
ARouter.openDebug() // 开启调试模式(如果在InstantRun模式下运行必须开启调试模式线上版本需要关闭,否则有安全风险)
}
ARouter.init(this)
// // 屏幕适配 AndroidAutoSize 以横屏高度为基准进行适配
// AutoSizeConfig.getInstance().isBaseOnWidth = false
}
}

View File

@ -3,10 +3,8 @@
package="com.quyunshuo.main">
<application>
<activity android:name=".MainActivity2"></activity>
<activity
android:name=".MainActivity"
android:screenOrientation="sensorLandscape">
<activity android:name=".MainActivity2" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

View File

@ -35,11 +35,43 @@
app:layout_constraintTop_toBottomOf="@+id/mBtn" />
<FrameLayout
android:layout_width="300dp"
android:layout_height="300dp"
android:layout_width="200dp"
android:layout_height="200dp"
android:background="#333"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<FrameLayout
android:layout_width="300dp"
android:layout_height="100dp"
android:background="#03A9F4"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<FrameLayout
android:layout_width="300dp"
android:layout_height="100dp"
android:background="#9BE446"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<FrameLayout
android:layout_width="200dp"
android:layout_height="300dp"
android:background="#FFEB3B"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<FrameLayout
android:layout_width="200dp"
android:layout_height="300dp"
android:background="#E317CE"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -10,10 +10,13 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/base_AppTheme">
<!-- &lt;!&ndash; 屏幕适配基准DP &ndash;&gt;-->
<!-- <meta-data-->
<!-- android:name="design_width_in_dp"-->
<!-- android:value="640" />-->
<!-- 屏幕适配基准DP -->
<meta-data
android:name="design_width_in_dp"
android:value="360" />
<meta-data
android:name="design_height_in_dp"
android:value="640" />
<!-- <meta-data-->
<!-- android:name="design_height_in_dp"-->
<!-- android:value="400" />-->