安卓应用开发-布局和控件

我们随便打开一个app,展现在我们眼前的界面,都是由布局或者说包含控件的布局展示

布局 

 布局是把它包含的控件怎么排布。常用的布局有LinearLayout (线性布局)、RelativeLayout(相对布局)、.FrameLayout(框架布局)。当然还有其他的布局,我在开发中都很少用到。如果是入门了解这3个布局就可以了。

LinearLayout (线性布局)

线性布局是里面的排布有规律,不是横向排布,就是纵向排布。

 

横向排布

 在布局内设置

android:orientation="horizontal"

下面的图是我设置了4个控件的横向线性布局

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal"
    tools:context=".MainActivity">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:t
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值