Android Studio | note | Hello World | LinearLayout | TextView
2018-03-13 20:15
459 查看
**作为刚开始的入门的小白,以下内容仅作为笔记。
部分内容来自网络。**
TextView
实例如图:
若要改变文本的位置进行修改就是对线性布局的属性(下图所在位置)进行修改。
1.文本位置
左上角
默认文字即在左上角可无需修改。
右上角
核心代码语句:
左下角
右下角
左居中
右居中
全居中
底部居中
android:gravity=”“ 是属于线性布局的一个属性,英译为重力,可对文本所在位置进行控制。
2.文本方向
orientation为方向,vertical为垂直, horizontal 为水平方向。
3.文本内容
android:text=” ” 双引号内的为显示的文本内容。
4.应用-个人名片
5.文件名的修改
直接对此处进行修改即可。
此处修改的位置一是页面的名称,二是APP的名称。
还可新建多个string,命名不同的 name,后来可直接引用,多处要修改的话,改这一个位置便可。
部分内容来自网络。**
知识点
LinearLayoutTextView
目标
利用线性布局对位置的处理。实例
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context="com.fanny.dome1.MainActivity"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="hello world ! " /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="hi! " /> </LinearLayout>
实例如图:
若要改变文本的位置进行修改就是对线性布局的属性(下图所在位置)进行修改。
1.文本位置
左上角
默认文字即在左上角可无需修改。
右上角
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" **android:gravity="right"//VIP** tools:context="com.fanny.dome1.MainActivity">
核心代码语句:
左下角
android:gravity="bottom"
右下角
android:gravity="bottom|right"
左居中
android:gravity="left|center"
右居中
android:gravity="right|center"
全居中
android:gravity="center"
底部居中
android:gravity="bottom|center"
android:gravity=”“ 是属于线性布局的一个属性,英译为重力,可对文本所在位置进行控制。
2.文本方向
android:orientation="vertical"
android:orientation="horizontal"
orientation为方向,vertical为垂直, horizontal 为水平方向。
3.文本内容
android:text="hi! "
android:text=” ” 双引号内的为显示的文本内容。
4.应用-个人名片
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:gravity="center|bottom" tools:context="com.fanny.dome1.MainActivity"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" < 4000 span class="hljs-attribute">android:text="hello world ! " /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=" 来自一个大一小白的笔记 " /> </LinearLayout>
5.文件名的修改
直接对此处进行修改即可。
此处修改的位置一是页面的名称,二是APP的名称。
还可新建多个string,命名不同的 name,后来可直接引用,多处要修改的话,改这一个位置便可。
相关文章推荐
- Android Studio | note | LinearLayout | RelativeLayout | Button
- Android Note-android studio 无法创建android项目
- Android Studio 使用心得,初篇(创建第一个Hello World!)
- 使用Android Studio创建第一个Hello World应用程序
- android studio 1.3.2创建的Hello World工程在老版本系统的手机上运行错误
- Android Studio 环境搭建与Hello World
- Android Studio 入门 Hello World
- android studio教程-创建第一个项目Hello World
- 基于Android Studio搭建hello world工程
- android studio新建hello world时出现Rendering Problems
- 配置android studio环境-Hello world
- 基于Android Studio搭建hello world工程
- Android Studio教程-创建第一个项目Hello World
- Android Studio | note | Layout
- 3.1 用Android Studio编写第一个应用程序Hello World
- Android Studio Note
- Android studio配置ndk和输出hello world
- Android Studio教程-创建第一个项目Hello World
- mac版本Android Studio2.3 修改默认ConstraintLayout为LinearLayout
- Android Studio上进行NDK编程之Hello world