Skip to content

Commit 8a99c6c

Browse files
committed
Demo used AndroidAutoSize
1 parent ecd9c43 commit 8a99c6c

File tree

5 files changed

+27
-15
lines changed

5 files changed

+27
-15
lines changed

demo/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ dependencies {
8080

8181
//现在已经将 Demo 中的屏幕适配框架从 AndroidAutoLayout 替换为 AndroidAutoSize, AndroidAutoLayout 和 AndroidAutoSize 可以在项目中共存
8282
//所以旧项目只要依赖 arms-autolayout 即可兼容之前的旧页面, 新页面使用 AndroidAutoSize 进行适配即可
83-
// implementation rootProject.ext.dependencies["autosize"]
83+
implementation rootProject.ext.dependencies["autosize"]
8484

8585
//Arms 核心库不再包含 Glide, 想使用其他图片加载框架或者想自行扩展 ImageLoaderStrategy 就不要依赖 arms-imageloader-glide
8686
//依赖 arms-imageloader-glide 后还需要在 GlobalConfiguration 中手动注册 GlideImageLoaderStrategy

demo/src/main/AndroidManifest.xml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,18 @@
2525
</intent-filter>
2626
</activity>
2727

28-
<!-- arms配置 -->
28+
<!-- 只要依赖 AutoSize 就必须填写设计图尺寸, 否则报错, 不想使用 AutoSize 就不要依赖 AutoSize
29+
只要填写完设计图的尺寸, AutoSize 就会自动启动, 以下 dp 尺寸是根据公式 px / (dpi / 160) 求出, 运算时使用测试机的 dpi 即可
30+
AutoSize 的详细介绍请看这里 https://juejin.im/post/5bce688e6fb9a05cf715d1c2
31+
-->
32+
<meta-data
33+
android:name="design_width_in_dp"
34+
android:value="360"/>
35+
<meta-data
36+
android:name="design_height_in_dp"
37+
android:value="640"/>
38+
39+
<!-- Arms 配置 -->
2940
<meta-data
3041
android:name="me.jessyan.mvparms.demo.app.GlobalConfiguration"
3142
android:value="ConfigModule"/>

demo/src/main/res/layout/activity_user.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
android:id="@+id/swipeRefreshLayout"
1414
android:layout_width="match_parent"
1515
android:layout_height="match_parent"
16-
android:paddingLeft="15px"
17-
android:paddingTop="15px"
16+
android:paddingLeft="4dp"
17+
android:paddingTop="4dp"
1818
>
1919

2020
<android.support.v7.widget.RecyclerView

demo/src/main/res/layout/include_title.xml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
xmlns:tools="http://schemas.android.com/tools"
66
android:id="@+id/toolbar"
77
android:layout_width="match_parent"
8-
android:layout_height="120px"
8+
android:layout_height="50dp"
99
android:background="?attr/colorPrimary"
1010
app:contentInsetStart="0dp"
1111
>
@@ -21,8 +21,8 @@
2121
android:layout_width="wrap_content"
2222
android:layout_height="wrap_content"
2323
android:layout_centerVertical="true"
24-
android:layout_marginLeft="30px"
25-
android:layout_marginRight="30px"
24+
android:layout_marginLeft="10dp"
25+
android:layout_marginRight="10dp"
2626
android:src="@mipmap/ic_arrow_back_white_24dp"/>
2727
</RelativeLayout>
2828

@@ -34,4 +34,5 @@
3434
android:textColor="@color/white"
3535
android:textSize="18sp"
3636
tools:text="@string/app_name"/>
37+
3738
</android.support.v7.widget.Toolbar>
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
3-
xmlns:tools="http://schemas.android.com/tools"
4-
android:layout_width="match_parent"
5-
android:layout_height="550px"
6-
android:layout_marginRight="15px"
7-
android:layout_marginBottom="15px"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
android:layout_width="match_parent"
5+
android:layout_height="174dp"
6+
android:layout_marginRight="4dp"
7+
android:layout_marginBottom="4dp"
88
>
99

1010
<ImageView
1111
android:id="@+id/iv_avatar"
1212
android:layout_width="match_parent"
1313
android:layout_height="match_parent"
1414
android:scaleType="centerCrop"
15-
tools:src="#000000" />
15+
tools:src="#000000"/>
1616

1717

1818
<TextView
1919
android:id="@+id/tv_name"
2020
android:layout_width="wrap_content"
2121
android:layout_height="wrap_content"
2222
android:layout_gravity="center_horizontal|bottom"
23-
android:layout_marginBottom="10px"
23+
android:layout_marginBottom="3dp"
2424
android:textColor="@color/white"
2525
android:textSize="18sp"
26-
tools:text="ss" />
26+
tools:text="ss"/>
2727

2828
</android.support.v7.widget.CardView>

0 commit comments

Comments
 (0)