在安卓中什么是线性布局,表格布局,相对布局???求详细答案,急急急!!!!

 我来答
  • 你的回答被采纳后将获得:
  • 系统奖励15(财富值+成长值)+难题奖励20(财富值+成长值)
王氏biyan5566
2016-03-06 · TA获得超过2694个赞
知道小有建树答主
回答量:842
采纳率:9%
帮助的人:236万
展开全部
线性布局(LinearLayout):在该标签下的所有子元素会根据orientation属性的值来决定是按行或者是按列来逐个显示。代码示例如下:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_name" />

<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />

<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/test" />

</LinearLayout>
而相对布局,则是根据控件的相对位置而言,比如居于按钮的左侧或者右侧,示例如下:
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/button1"
android:layout_alignTop="@id/button1"
android:text="@string/hello_world" />

<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="@string/app_name" />

</RelativeLayout>
分享
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
回忆在上辈子
2016-03-06 · TA获得超过1148个赞
知道大有可为答主
回答量:1211
采纳率:0%
帮助的人:880万
展开全部
线性布局有两种
横和竖
控件和控件的排列是按线性排列的
比如控件1再放控件就是控件1控件3等等
它们之间的位置是按着顺序排列的(形成一条线一样)

表格布局就是行x列的这种方式
然后根据你的需求将控件添加在哪行哪列这种

相对布局
控件的位置是相对于某个参照物放置的
比如相对某个控件多少距离
相对上方多少距离等等放置控件
更多追问追答
追问
你说的控件是什么意思
追答
构件知不知道
比如TextView这些显示在界面上的按钮啊等等
本回答被提问者和网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 1条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式