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

  • 相关阅读:
    JQ_浏览器窗口改变触发
    5. 通过PHP反序列化进行远程代码执行
    2. 文件包含(150)
    1. md5 collision(50)
    4.xpath注入详解
    2.HTTP头注入
    1.5 xss漏洞修复
    1.4 DVWA亲测XSS漏洞
    1.如何绕过WAF(Web应用防火墙)
    1.3 xss原理分析与剖析(4)
  • 原文地址:https://www.cnblogs.com/caoxinyu/p/6647864.html
Copyright © 2011-2022 走看看