赞
踩
AutoLayout适配问题主要分为两种方式
首先要导入库文件到build.gradle中
compile 'com.zhy:autolayout:1.4.5'
- //activity继承AutoLayoutActivity类
- public class MainActivity extends AutoLayoutActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- }
-
- }
(2)需要添加
- 然后再AndroidManifest.xml中添加
- <meta-data android:name="design_width" android:value="768">
- </meta-data>
- <meta-data android:name="design_height" android:value="1280">
- </meta-data>
- <com.zhy.autolayout.AutoRelativeLayout
- android:layout_width="match_parent"
- android:layout_height="@dimen/m108"
- android:layout_marginTop="26px"
- android:background="#ffffffff"
- >
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="护照:G50786449"/>
- </com.zhy.autolayout.AutoRelativeLayout>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。