ソースを参照

导入屏幕适配

詹子聪 5 年 前
コミット
d21a32656b

+ 6 - 2
app/src/main/res/layout/activity_main.xml

@@ -4,8 +4,12 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     tools:context=".ui.home.HomeActivity"
-    android:orientation="vertical"
-    android:gravity="center_horizontal">
+    android:orientation="vertical">
+
+    <View
+        android:layout_width="359dp"
+        android:layout_height="50dp"
+        android:background="@android:color/black"/>
 
     <TextView
         android:id="@+id/tv_name"

+ 1 - 0
common/build.gradle

@@ -72,4 +72,5 @@ dependencies {
 
     // 动态代理
     //api group: 'cglib', name: 'cglib', version: '3.3.0'
+
 }

+ 3 - 0
mvp/build.gradle

@@ -44,4 +44,7 @@ dependencies {
     //def activity_version = "1.1.0"
     def activity_version = "1.2.0-beta01"
     implementation "androidx.activity:activity:$activity_version"
+
+    // 屏幕适配
+    api 'me.jessyan:autosize:1.2.1'
 }

+ 10 - 1
mvp/src/main/AndroidManifest.xml

@@ -1,2 +1,11 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="com.miekir.mvp" />
+    package="com.miekir.mvp" >
+    <application>
+        <meta-data
+            android:name="design_width_in_dp"
+            android:value="360"/>
+        <meta-data
+            android:name="design_height_in_dp"
+            android:value="640"/>
+    </application>
+</manifest>

+ 1 - 1
network/build.gradle

@@ -54,7 +54,7 @@ dependencies {
     androidTestImplementation 'androidx.test.ext:junit:1.1.1'
     androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
 
-    api project(path: ':mvp')
+    implementation project(path: ':mvp')
     implementation project(path: ':common')
     implementation fileTree(dir: 'libs', include: ['*.jar'])