张静初曝中性大片,越策越开心主持人,高光威
android布局
线性布局它是水平或者垂直来排列的布局。
详解:
首先要设置布局的排列方式它有垂直排列和水平排列,
垂直排列:android:orientation="vertical"
水平排列:android:orientation="horizontal"
(1)加权重:
android:layout_weight="值
(2)设置大小给宽高:
水平布局宽为0,垂直布局高为0.
代码案例:
xml version="1.0" encoding="utf-8"> <linearlayout xmlns:android="https://schemas.android.com/apk/res/android" xmlns:app="https://schemas.android.com/apk/res-auto" xmlns:tools="https://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".ccd" android:orientation="vertical" > <button android:layout_width="200dp" android:layout_height="0dp" android:layout_weight="2" android:text="左边" android:background="#0f0" /> <button android:layout_width="200dp" android:layout_height="0dp" android:layout_weight="2" android:text="右边" android:layout_gravity="right" android:background="#aaa" /> <button android:layout_width="200dp" android:layout_height="0dp" android:layout_weight="1" android:text="左边" android:background="#7788d6" /> linearlayout>
效果图:
=====================================================================
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Android Manifest中meta-data扩展元素数据的配置与获取方式
Android实现获取meta-data和build.gradle的值
Android获取清单文件中的meta-data,解决碰到数值为null的问题
解决webview 第二次调用loadUrl页面不刷新的问题
解决Android WebView拦截url,视频播放加载失败的问题
Android webview加载https链接错误或无响应的解决
网友评论