Android环境搭配及简单HelloWord(20)
时间:2026-01-16
时间: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"
上一篇:1、安全生产目标管理及奖罚制度
下一篇:建筑施工项目物资管理的改进措施