简单学习Android TextView

正文

本文为大家分享了TextView的简单学习资料,供大家参考,具体内容如下

XML的几个特殊属性

android:autoLink 用于指定是否将文本转换成可点击的超链接形式,它的属性值有none,web,email,phone,map或all android:drawBottom 用于将图片添加到文本的低端 同理还有上,左,右 android:hint 当文本为空时,默认显示的是什么 android:Grivaity 文本的对齐方式 android:inputType 显示的文本类型

Mainactivity.XML代码

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:paddingBottom="@dimen/activity_vertical_margin"
  android:paddingLeft="@dimen/activity_horizontal_margin"
  android:paddingRight="@dimen/activity_horizontal_margin"
  android:paddingTop="@dimen/activity_vertical_margin"
  android:orientation="vertical"
  tools:context=".MainActivity"  

  <TextView
    android:id="@+id/textview1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:hint="666"
     / 
   <TextView
    android:id="@+id/textview2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:singleLine="true"
    android:text="测试是否为单行模式"
     / 
   <TextView
    android:id="@+id/textview3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="http://www.baidu.com"
    android:autoLink="web"
     / 

</LinearLayout 

mainACtivity.java

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:paddingBottom="@dimen/activity_vertical_margin"
  android:paddingLeft="@dimen/activity_horizontal_margin"
  android:paddingRight="@dimen/activity_horizontal_margin"
  android:paddingTop="@dimen/activity_vertical_margin"
  android:orientation="vertical"
  tools:context=".MainActivity"  

  <TextView
    android:id="@+id/textview1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:hint="666"
     / 
   <TextView
    android:id="@+id/textview2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:singleLine="true"
    android:text="测试是否为单行模式"
     / 
   <TextView
    android:id="@+id/textview3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="http://www.baidu.com"
    android:autoLink="web"
     / 

</LinearLayout 

运行结果

上述中的链接如果把apk导入到手机上真的能连接到百度,是不是很神奇….

学习Android 更多技术点可以扫描免费领取!

腾讯技术团队出品】Android零基础入门到精通,Android Studio安装教程+全套安卓基础教程

Android是使用Java语言开发的,所以想要学习Android,你必须有一定的Java基础,否则根本进行不下去。当然你没有也没有关系,这里为你提供一份Android编程入门教程,相信你能很快上手学习。

资料获取方式:

Android编程入门教程

Java语言基础从入门到熟悉

img

Kotlin语言基础从入门到熟悉

img

Android 技术栈从入门到熟悉

img

Android Jetpack 全家桶全面学习

img

学习Java期间使用的一般都是Eclipse。

但对于Android来说,建议使用 Android Studio 而不是Eclipse ADT。

对于新手来说可能安装Android Studio存在一定困难你可以看着以下视频,一步步的跟着学习安装运行

Android Studio 安装教程

img

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值