安卓如何实现线性布局

 时间:2024-10-13 14:58:10

1、打开我们的编辑软件eclipse软件,如图所示;然后建立一个工程,至于怎么建工程,我相信小伙伴们应该知道怎么弄了;

安卓如何实现线性布局

2、找到文件目录,res-layout下的一个文件,然后选择,activity_main.xml。如图中所示,打开文档。

安卓如何实现线性布局

3、在整个界面中输入一下代码:<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal"> <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="寻迹" android:layout_weight="1" /> <Button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=" 壁障" android:layout_weight="1" /> <Button android:id="@+id/button3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=" 追踪" android:layout_weight="1" /> <Button android:id="@+id/button4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=" 学习" android:layout_weight="1" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /></LinearLayout>接着保存;

安卓如何实现线性布局

4、点击如图所示的地方进行执行,我们的软件;

安卓如何实现线性布局

5、如图所示,我们的执行结果如下;

安卓如何实现线性布局
  • 详解MongoDB如何更新文档 ( 增加和删除属性 )
  • 多可系统怎么找回管理员用户名和密码
  • 携程旅行在哪查看直播平台信息
  • 怎样打开win2016的注册表
  • javascript(js)中怎么获取下拉框option的值?
  • 热门搜索
    肾结晶是怎么回事 被蜂子蛰了怎么办 肺纹理增多是怎么回事 枸杞子怎么吃效果最好 喉咙里有异物感是怎么回事 尿潜血是怎么回事 菠萝蜜的核怎么吃 笔记本电脑怎么连wifi 胸口闷堵是怎么回事 自画像怎么画