android LinearLayout 适配
来源:互联网 发布:七上生物行知天下答案 编辑:程序博客网 时间:2024/06/05 04:08
在android开发开发中使用LinearLayout来进行布局的安排,现在将其中的相关的适配问题总结:
1、使用LinearLayout的layout_weight和wrap_content进行配合使用,当在进行页面的适配设计的时候使用比例,无可争议是最好的方式就是按照比例进行页面的布局,这种方式在一定范围可以避免页面布局出现大的错乱,还有一点我感觉使用fragment进行页面的重构也很重要,将大的页面进行分割,分割成小的模块,这样不仅可以提高代码的重用更可以降低UI设计困难,Layout——weight是按照同一级的比例进行分配的,子模块是没有影响,还有一点就是fragment进行碎片化以后更加可以提高代码的可扩展性还有代码自身的适应能力
layout_weight 叫做剩余权重(很有才的名字)
下面是测试的一下代码:
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:orientation="vertical" android:layout_height="match_parent"> <LinearLayout android:layout_weight="1" 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:layout_weight="1" android:background="@android:color/holo_red_dark" android:text="111" android:textSize="20sp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="2" android:background="@android:color/holo_green_light" android:text="222" android:textSize="20sp" /> </LinearLayout> <LinearLayout android:layout_weight="2" 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:layout_weight="1" android:background="@android:color/holo_red_dark" android:text="111" android:textSize="20sp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="2" android:background="@android:color/holo_green_light" android:text="222" android:textSize="20sp" /> <LinearLayout android:layout_weight="2" android:background="@color/black" android:layout_width="wrap_content" android:layout_height="wrap_content"></LinearLayout> </LinearLayout></LinearLayout>下面是实现的效果
0 0
- android LinearLayout 适配
- android LinearLayout
- android LinearLayout
- Android -- LinearLayout
- Android LinearLayout
- android linearlayout
- Android LinearLayout
- Android 布局 LinearLayout
- Android 自定义 LinearLayout
- Android之LinearLayout、AbsoluteLayout
- android布局之LinearLayout
- android之布局LinearLayout
- Android 布局 之 LinearLayout
- Android基础(二) LinearLayout
- Android基础(二) LinearLayout
- android linearlayout 平分一行
- android linearLayout UI 集锦
- android 之LinearLayout布局
- 产品开关量输出 PNP NPN
- spring mvc中redirect/forward:url与拦截器的关系
- boa cgi html CGIC
- 数据结构复习-图、查找、排序
- VC++6.0 MFC窗口中移动的圆
- android LinearLayout 适配
- Dijkstra算法
- 每日一题7:二分搜索
- 简单的实现了Dijkstra,
- Python 多线程效率不高吗?
- WebRTC 入门 01 简介 II
- [积累]vector的详细使用, 包括iterator
- Dijkstra算法详解:
- Excel塾_http://kokodane.com/