zoukankan      html  css  js  c++  java
  • Android 布局开发之百分比布局、弹性布局

    1.百分比布局
    很简单,超级简单。引用之后就可以使用了。

    compile 'com.android.support:percent:23+'

    git地址:
    https://github.com/JulienGenoud/android-percent-support-lib-sample.git

    注意:使用的时候,百分比布局只对他包含的一级有用。就是直属子布局有用。上代码:

    <?xml version="1.0" encoding="utf-8"?>
    <android.support.percent.PercentFrameLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    <com.google.android.flexbox.FlexboxLayout
        xmlns:fle="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_heightPercent="80%"
        app:layout_widthPercent="80%"
        android:background="@color/colorAccent"
        app:flexWrap="wrap"
        app:alignItems="flex_start"
        app:alignContent="flex_start" >
            <android.support.percent.PercentFrameLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                >
                    <TextView
                        android:layout_width="0dp"
                        android:text="aaaasdfsadfasdfsa"
                        app:layout_heightPercent="20%"
                        app:layout_widthPercent="20%"
                        android:layout_height="0dp" />
    
    
    
            </android.support.percent.PercentFrameLayout>
    
            <android.support.percent.PercentFrameLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                >
                    <TextView
                        android:layout_width="0dp"
                        android:text="aaaasdfsadfasdfsa"
                        app:layout_heightPercent="20%"
                        app:layout_widthPercent="20%"
                        android:layout_height="0dp" />
    
            </android.support.percent.PercentFrameLayout>
    </com.google.android.flexbox.FlexboxLayout>
    </android.support.percent.PercentFrameLayout>
    

    也就是说只能对她的直属下一级起作用。

    2.弹性布局:

    compile 'com.google.android:flexbox:0.1.3'

    git:
    https://github.com/google/flexbox-layout.git

  • 相关阅读:
    OpenCV 立体匹配 (自带程序)
    OpenCV 双目标定 ( 自带的例子)
    容器
    OpenCV 多边形逼近
    C++ 读取文件
    OpenCV 快速连通区域分析
    图像任意旋转
    OpenCV 模板匹配函数matchTemplate详解
    二十一:scrapy中设置下载延时与自动限速
    二十、scrapy中的Request对象和Response对象
  • 原文地址:https://www.cnblogs.com/caoxinyu/p/6647864.html
Copyright © 2011-2022 走看看