Android开发编码规范之适配规则(四)
2016-10-10 09:39
381 查看
Android开发编码规范之适配规则(四)
1.适配布局
1.1采用比例布局方式
<android.support.percent.PercentRelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/llyt_all" > <!--年级--> <android.support.percent.PercentRelativeLayout android:id="@+id/pc_rl" android:layout_width="0dp" android:layout_height="0dp" android:background="@drawable/bg_line" android:orientation="vertical" app:layout_heightPercent="46%" app:layout_marginLeftPercent="3.88%" app:layout_marginRightPercent="3.88%" app:layout_marginTopPercent="3.5%" app:layout_widthPercent="100%"> <LinearLayout android:id="@+id/pc_ll1" android:layout_width="0dp" android:layout_height="0dp" android:gravity="center" app:layout_heightPercent="18%" app:layout_widthPercent="100%"> <TextView android:id="@+id/tv_book" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/main_tv_book" android:textColor="@color/black_gray" android:textSize="16sp" /> </LinearLayout> <android.support.percent.PercentRelativeLayout android:id="@+id/pc_rl1" android:layout_width="0dp" android:layout_height="0dp" android:layout_below="@+id/pc_ll1" app:layout_heightPercent="47%" app:layout_marginTopPercent="3.2%" app:layout_widthPercent="100%"> <android.support.percent.PercentRelativeLayout android:id="@+id/pc_rl2" android:layout_width="0dp" android:layout_height="0dp" app:layout_heightPercent="100%" app:layout_widthPercent="50%"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/main_tv_residue" android:textColor="@color/black_gray_dark" android:textSize="13sp" app:layout_marginLeftPercent="35%" /> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:orientation="horizontal" app:layout_marginTopPercent="28%"> <TextView android:id="@+id/tv_remainday" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/main_tv_remainday" android:textColor="@color/black_gray" android:textSize="40sp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom" android:layout_marginBottom="4dp" android:text="@string/main_tv_day" android:textColor="@color/black_gray" android:textSize="13sp" /> </LinearLayout> <TextView android:id="@+id/tv_practice" android:layout_width="90dp" android:layout_height="28dp" android:layout_alignParentBottom="true" android:background="@drawable/bg_rectangle" android:gravity="center" android:text="@string/main_tv_practice" android:textColor="#f9b500" android:textSize="13sp" app:layout_marginLeftPercent="16%" /> </android.support.percent.PercentRelativeLayout> <android.support.percent.PercentRelativeLayout android:layout_width="0dp" android:layout_height="0dp" android:layout_alignParentRight="true" app:layout_heightPercent="100%" app:layout_widthPercent="50%"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:text="@string/main_tv_todaybackword" android:textColor="@color/black_gray_dark" android:textSize="13sp" app:layout_marginRightPercent="33%" /> <TextView android:id="@+id/tv_tadayword" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:text="@string/main_tv_tv_todayword" android:textColor="#fde6a9" android:textSize="40sp" app:layout_marginTopPercent="28%" /> <TextView android:id="@+id/tv_plan" android:layout_width="90dp" android:layout_height="28dp" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:background="@drawable/bg_rectangle" android:gravity="center" android:text="@string/main_tv_plan" android:textColor="#f9b500" android:textSize="13sp" app:layout_marginRightPercent="20%" /> </android.support.percent.PercentRelativeLayout> </android.support.percent.PercentRelativeLayout> <android.support.percent.PercentRelativeLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@+id/pc_rl1" android:orientation="vertical" android:paddingLeft="15dp" android:paddingRight="15dp" app:layout_marginTopPercent="12%"> <LinearLayout android:id="@+id/pc_ll2" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/main_thiscomple" android:textColor="@color/black_gray" android:textSize="16sp" /> <TextView android:id="@+id/tv_undone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:text="@string/main_tv_undone" android:textColor="#31aaff" android:textSize="16sp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/main_slash" android:textColor="#31aaff" android:textSize="16sp" /> <TextView android:id="@+id/tv_comple" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/main_tv_complete" android:textColor="@color/black_gray" android:textSize="16sp" /> </LinearLayout> <com.eaglesoul.eplatform.english.ui.widget.ProgressView android:id="@+id/progress" android:layout_width="match_parent" android:layout_height="9dp" android:layout_below="@+id/pc_ll2" android:layout_marginTop="10dp" app:layout_marginTopPercent="10%" /> </android.support.percent.PercentRelativeLayout> </android.support.percent.PercentRelativeLayout> <android.support.percent.PercentRelativeLayout android:id="@+id/pc_rl3" android:layout_width="match_parent" android:layout_height="0dp" android:layout_below="@+id/pc_rl" app:layout_heightPercent="28%" app:layout_marginLeftPercent="4.2%" app:layout_marginRightPercent="4.2%" app:layout_marginTopPercent="2.8%"> <com.eaglesoul.eplatform.english.ui.widget.MainImageView android:id="@+id/ibtn_study" android:layout_width="0dp" android:layout_height="0dp" android:background="@drawable/bt_study2" android:scaleType="centerInside" app:layout_heightPercent="100%" app:layout_widthPercent="47%" /> <com.eaglesoul.eplatform.english.ui.widget.MainImageView android:id="@+id/ibtn_analysis" android:layout_width="match_parent" android:layout_height="0dp" android:layout_alignParentRight="true" android:background="@drawable/bt_analysis2" android:scaleType="centerInside" app:layout_heightPercent="100%" app:layout_widthPercent="47%" /> </android.support.percent.PercentRelativeLayout> <FrameLayout android:layout_width="0dp" android:layout_height="0dp" android:layout_below="@+id/pc_rl3" app:layout_heightPercent="100%" app:layout_marginBottomPercent="1.4%" app:layout_marginLeftPercent="3.8%" app:layout_marginRightPercent="3.8%" app:layout_marginTopPercent="2.2%" app:layout_widthPercent="100%"> <com.eaglesoul.eplatform.english.ui.widget.MainImageView android:id="@+id/ibtn_pk" android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="center" android:background="@drawable/bt_pk3" android:src="@drawable/bt_pk2" /> </FrameLayout> </android.support.percent.PercentRelativeLayout>
1.2加入可以滑动的控件进行布局,例如RecyclerView ScrollView等可滑动空间
相关文章推荐
- Android开发规范之编码规范
- Android开发简要编码规范
- Android开发规范之编码规范
- Android开发编码规范之文件命名(一)
- Android开发编码规范、性能优化、UI优化及开发建议
- Android开发规范--编码规范/性能优化/UI优化
- Android项目开发中编码风格规范总结
- Android开发规范之编码规范
- Android开发规范与编码规范
- Android开发编码规范之注释(二)
- Android开发规范之编码规范
- Android面试、开发之高手 编码规范与细节
- Android开发编码规范
- Android开发命名规范和编码规范
- Android开发规范之编码规范
- Android开发规范之编码规范
- Android开发规范之编码规范
- Android开发规范之编码规范
- Android编码规范之命名规则
- Android开发命名规范和编码规范