Skip to content

Commit 1d5b828

Browse files
committed
add screenhot
1 parent 56ffff4 commit 1d5b828

File tree

5 files changed

+13
-9
lines changed

5 files changed

+13
-9
lines changed

Library/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ android {
55
buildToolsVersion "22.0.1"
66

77
defaultConfig {
8-
minSdkVersion 14
8+
minSdkVersion 7
99
targetSdkVersion 22
1010
versionCode 1
1111
versionName "1.0"

Library/src/main/java/cn/gavinliu/android/lib/scale/helper/ScaleLayoutHelper.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
*/
1717
public class ScaleLayoutHelper {
1818

19+
private static final boolean mDBG = true;
1920
private static final String TAG = "ScaleLayoutHelper";
21+
2022
private final ViewGroup mHost;
2123

2224
private ScaleLayoutInfo mHostLayoutInfo;
@@ -41,7 +43,6 @@ public void adjustChildren(int widthMeasureSpec, int heightMeasureSpec) {
4143
for (int N = this.mHost.getChildCount(); i < N; ++i) {
4244
View view = this.mHost.getChildAt(i);
4345
ViewGroup.LayoutParams params = view.getLayoutParams();
44-
Log.d(TAG, "should adjust " + view + " " + params);
4546

4647
if (params instanceof ScaleLayoutParams) {
4748
ScaleLayoutInfo info = ((ScaleLayoutParams) params).getScaleLayoutInfo();
@@ -77,7 +78,6 @@ public void restoreOriginalParams() {
7778
for (int N = this.mHost.getChildCount(); i < N; ++i) {
7879
View view = this.mHost.getChildAt(i);
7980
ViewGroup.LayoutParams params = view.getLayoutParams();
80-
Log.d(TAG, "should restore " + view + " " + params);
8181

8282
if (params instanceof ScaleLayoutParams) {
8383
ScaleLayoutInfo info = ((ScaleLayoutParams) params).getScaleLayoutInfo();
@@ -222,7 +222,6 @@ public boolean handleMeasuredStateTooSmall() {
222222
for (int N = this.mHost.getChildCount(); i < N; ++i) {
223223
View view = this.mHost.getChildAt(i);
224224
ViewGroup.LayoutParams params = view.getLayoutParams();
225-
Log.d(TAG, "should handle measured state too small " + view + " " + params);
226225

227226
if (params instanceof ScaleLayoutParams) {
228227
ScaleLayoutInfo info = ((ScaleLayoutParams) params).getScaleLayoutInfo();

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,18 @@
1818
``android-percent-support-lib`` 需要把设计尺寸算成百分比
1919
``Android-ScaleLayout`` 直接把设计尺寸填入``layou.xml``即可
2020

21-
### Android有良好的多屏适配系统,为何设计ScaleLayout?
2221

22+
## How to look?
23+
24+
![screenhot](/screenhot.png)
2325

2426

2527
## 如何使用
2628

2729
### 基本原理
2830
+ 设计属性
2931
设计手机的宽高,像素密度,设计尺寸(dp)
30-
+ 设备属性
32+
+ 设备属性
3133
设备手机的宽高,像素密度
3234

3335
```java
@@ -48,15 +50,18 @@ float realPixel = (mScreenWidth * designDensity * getPixelSize()) / (designScree
4850
<resources>
4951
<declare-styleable name="ScaleLayout">
5052

53+
<!-- 根据宽或者高缩放 -->
5154
<attr name="layout_scale_by" format="enum">
5255
<enum name="width" value="0" />
5356
<enum name="height" value="1" />
5457
</attr>
5558

59+
<!-- 设计图的相关属性:必须写在 Scale*Layout 中 -->
5660
<attr name="layout_design_width" format="dimension" />
5761
<attr name="layout_design_height" format="dimension" />
5862
<attr name="layout_design_density" format="integer" />
5963

64+
<!-- 控件大小间距相关属性 -->
6065
<attr name="layout_width" format="dimension" />
6166
<attr name="layout_height" format="dimension" />
6267

@@ -128,10 +133,10 @@ float realPixel = (mScreenWidth * designDensity * getPixelSize()) / (designScree
128133

129134
### 注意事项
130135

131-
1. 建议缩放方式
136+
1. 建议缩放方式
132137
上下滑动的界面按**屏幕宽**等比缩放
133138
左右滑动的界面按**屏幕高**等比缩放
134-
2. 控件须知
139+
2. 控件须知
135140
``cn.gavinliu.android.lib.scale.Scale*Layout`` 必须包含 layout_design_*
136141
``layout_scale_by`` 默认值为 width
137142

Sample/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ android {
66

77
defaultConfig {
88
applicationId "cn.gavinliu.android_scalelayout"
9-
minSdkVersion 14
9+
minSdkVersion 7
1010
targetSdkVersion 22
1111
versionCode 1
1212
versionName "1.0"

screenhot.png

405 KB
Loading

0 commit comments

Comments
 (0)