我是靠谱客的博主 唠叨跳跳糖,最近开发中收集的这篇文章主要介绍第六节--LinearLayout布局的介绍和应用,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

View:

LinearLayout:

java.lang.Object
   ↳android.view.View
    ↳android.view.ViewGroup
     ↳android.widget.LinearLayout


原意

A Layout that arranges its children in a single column or a single row. The direction of the row can be set by calling setOrientation(). You can also specify gravity, which specifies the alignment of all the child elements by calling setGravity() or specify that specific children grow to fill up any remaining space in the layout by setting the weight member of LinearLayout.LayoutParams. The default orientation is horizontal.

译文

一个布局是对在行或列方向的子控件的安排。行的方向我们可以通过调用setOrientation()方法来设置。也可以通过指定它的gravitgy,通过调用setGravity()方法或指定子控件的空间填充来指定子控件元素的排列方向。缺省状态为水平方向。


 

 

XML属性

     android:id : 为控件指定相应的ID
     android:text: 指定控件当中显示的文字    

     android:grivity: 指定控件的基本位置,比如说居中,居右等位置
     android:textSize:指定控件当中字体的大小
     android:background: 使用drawable指定该控件所使用的背景色,RGB命名法
     android:width: 指定控件的宽度
     android:height: 指定控件的高度
     android:padding* : 指定控件的内边距,也就是说控件当中的内容
     android:sigleLine: 如果设置为真的话,则将控件的内容在同一行当中进行显示
     layout_weight: 用于给一个线性布局中的诸多视图的重要度赋值
     android:layout_gravity: 表示按钮在界面上的位置
     android:gravity : 表示button上的字在button上的位置
     android:visibility: 控制视图控件的可见性
     ndroid:baselineAligned:是否允许用户调整它内容的基线

 


 

 

a.lang.Object
   ↳android.view.View

 

 


 

原意:

This class represents the basic building block for user interface components. A View occupies a rectangular area on the screen and is responsible for drawing and event handling. View is the base class for widgets, which are used to create interactive UI components (buttons, text fields, etc.). The ViewGroup subclass is the base class for layouts, which are invisible containers that hold other Views (or other ViewGroups) and define their layout properties.

译文:

这个类代表了用户界面组件的基本构造块。一个View在屏幕上占据一个矩形区域,并绘制和事件处理工作。View是控件的基本类它是用来创建交互式UI组件(按钮,文本框等)的。ViewGroup的基类布局的子类,它是一种无形的容器,可以保留其它控件视图和布局属性。

 


 

ViewGroup:

java.lang.Object
   ↳android.view.View
    ↳android.view.ViewGroup

原意:

A ViewGroup is a special view that can contain other views (called children.) The view group is the base class for layouts and views containers.

译文

一个ViewGroupis一个能包含其它View的视图,它是一个能包含布局容器的基类布局


演示效果:

最后

以上就是唠叨跳跳糖为你收集整理的第六节--LinearLayout布局的介绍和应用的全部内容,希望文章能够帮你解决第六节--LinearLayout布局的介绍和应用所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(36)

评论列表共有 0 条评论

立即
投稿
返回
顶部