Android环境搭配及简单HelloWord(20)

时间:2026-01-16

介绍Android开发环境的搭建

android:orientation:

android:orientation="vertical"

可以改成:

android:orientation="horizontal" vertical此属性代表View是以垂直进行排序

horizontalvertical此属性代表View是以横向进行排序

android:layout_width:

android:layout_width="fill_parent"

可以改成:

android:layout_width="wrap_content" fill_parent横向全部填充

wrap_content横向顺其改变(如图片是多大就显示多大)

当然我们还可以为它设置大小如:

android:layout_width="61px"

android:layout_height与android:layout_width类似

android:text:

android:text="@string/hello"

这里text代表是显示什么内容

@string/hello 代表在values/Strings.xml文件里面读取

我们打开values/Strings.xml文件

<?xml version="1.0" encoding="utf-8"?> <resources>

<string name="hello">Hello World, MainActivity!</string> <string name="app_name">My_One_Android_Project</string> </resources>

会发现一个name为hello 的String声明并且其值于我们之前模拟器所显示的内容一样

可能还有些人对于

LinearLayout

布局中的

android:orientation="vertical" android:orientation="horizontal" 这2者不是很了解 好的现在我做一个列子:

将main.xml进行修改部分

<?xml version="1.0" encoding="utf-8"?> <LinearLayout

xmlns:android="/apk/res/android"

Android环境搭配及简单HelloWord(20).doc 将本文的Word文档下载到电脑

精彩图片

热门精选

大家正在看

× 游客快捷下载通道(下载后可以自由复制和排版)

限时特价:4.9 元/份 原价:20元

支付方式:

开通VIP包月会员 特价:19元/月

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219