Android TextView/EditView

个人理解

TextView就是一个文本,在手机虚拟机屏幕上以字幕的形式显示

EditView是编辑框,可以在框内输入内容

 两者实现方法很类似以TextView详解;

EditView 格式:<EditView  />

TextView格式:<TextView />

<TextView  
   android:id="@+id/textview"  
   android:layout_width="wrap_content"  
   android:layout_height="wrap_content"  
   android:autoLink="all"  
   android:textColor="#00FF00"  
   android:textSize="20sp"  
   android:text="欢迎大家访问我的Blog,我的博客:http://blog.youkuaiyun.com/candy421458216 , 我的电话:110"
/>

详细分析下这段代码:

android:id="@+id/textview"

android:id可以定义三种id

1.android:id = "@android:id/tabhost"

这种引用,一般是android组件内部调用时使用

例如tanhost中的:mTabContent = (FrameLayout) findViewById(com.android.internal.R.id.tabcontent);

2.android:id = "@+id/IIRoot"

自己添加定义的一个id;可以在java class中引用定义的变量:R.id.IIRoot

3.android:id = "@id/IIRoot"
使用一个已经存在的ID引用

 

android:layout_width="wrap_content"
android:layout_height="wrap_content"


wrap_content是表示格局的一种参数,一共有三个参数:wrap_content, fill_parent, match_parent

与布局相关的还有:

android:orientation = "vertical"

android:layout_weight="1"

参数vertical表示垂直方式对齐,horizontal表示水平方式对齐;  "1"也可以是其他的数字,是表示button按钮的显示比例;

android:autoLink="all"   
android:textColor="#00FF00"   
android:textSize="20sp"   
autoLink设置是否当文本为URL链接(none/web/phone/map/all) ; 
android:text="欢迎大家访问我的Blog,我的博客:http://blog.youkuaiyun.com/candy421458216 , 我的电话:110"


 

web设置自动识别链接,值web为匹配Web网址;

phone设置自动识别链接,值phone为匹配电话号码;

email设置自动识别链接,值email为匹配Email地址;

all设置自动识别链接,值all为匹配所有;

textColor为文本的颜色显示,textSize为文字大小;text内容则是在屏幕上显示的文本;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值