zoukankan      html  css  js  c++  java
  • 【安德鲁斯】让我们超越容器限制的子元素、!如何实现更灵活的布局容器、!

    安卓LinearLayout这是最方便的容器,但有时外观似不满意,事实上,安德鲁斯真的灵活的容器。!

    1.让我们超越容器限制的子元素。

    初步设想,外观似子元件赋予margin负能超过,来。

    事实上是能够绘制出来的,红色容器的容器(注意是红色控件的容器,不是红色容器自己)给定android:clipChildren="false"就可以,该參数默觉得true,即其内元素会被其容器裁剪,注意之所以是红色容器的容器,是由于绿色button突出部分已不在红色容器绘制范围内了,而属于红色容器的容器。

         


    2.以下这样的布局,按传统模式一般最外层用LinearLayout,里面再套RelativeLayout,以及各种恶心的排位。

    事实上能够来得更爽快一点,一个LinearLayout容器搞定。

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#ffffff"
        android:clipToPadding="false"
        android:orientation="horizontal"
        android:padding="10dp" >
    
        <TextView
            android:id="@+id/tvVIP"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="VIP1"
            android:textColor="#000000"
            android:textStyle="bold" />
    
        <EditText
            android:id="@+id/et"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:paddingRight="20dp"
            android:text="1000" />
    
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="-20dp"
            android:text="元" />
    
        <Button
            android:id="@+id/btnDel"
            android:layout_width="wrap_content"
            android:layout_height="20dp"
            android:layout_marginLeft="-15dp"
            android:layout_marginTop="-10dp" />
    
    </LinearLayout>





    版权声明:本文博主原创文章。博客,未经同意不得转载。

  • 相关阅读:
    Linux文本检索命令grep笔记
    Python中字典的相关操作
    Go 语言函数闭包
    Go 语言多维数组
    Go 错误处理
    Go 语言接口
    Go 语言类型转换
    Go 语言递归函数
    Go 语言Map(集合)
    Go 语言范围(Range)
  • 原文地址:https://www.cnblogs.com/blfshiye/p/4839977.html
Copyright © 2011-2022 走看看