新版Anroid开发教程+笔记七--基础UI编程1.doc

  1. 1、本文档共19页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
新版Anroid开发教程笔记七--基础UI编程1

封面 Android 基础UI编程 1 更改与显示文字标签 TextView 标签的使用 导入TextView包 import android.widget.TextView; 在mainActivity.java中声明一个TextView private TextView mTextView01; 在main.xml中定义一个TextView TextView android:text=TextView01 android:id=@+id/TextView01 android:layout_width=wrap_content android:layout_height=wrap_content android:layout_x=61px android:layout_y=69px /TextView 利用findViewById()方法获取main.xml中的TextView mTextView01 = (TextView) findViewById(R.id.TextView01); 设置TextView标签内容 String str_2 = 欢迎来到Android 的TextView 世界...; mTextView01.setText(str_2);TextView android:id=@+id/TextView02 android:layout_width=wrap_content android:layout_height=wrap_content android:autoLink=all android:text=请访问: /index.html /TextView android.graphics.Color实践----Color颜色变幻 android.graphics.ColorColor.BLACK Color.BLUE Color.CYAN Color.DKGRAY Color.GRAY Color.GREEN Color.LTGRAY Color.MAGENTA Color.RED Color.TRANSPARENT Color.WHITE Color.YELLOW 黑色 蓝色 青绿色 灰黑色 灰色 绿色 浅灰色 红紫色 红色 透明 白色 黄色 编程实现颜色变幻 修改mainActivity.java文件,添加12个TextView对象变量,一个LinearLayout对象变量、一个WC整数变量、一个LinearLayout.LayoutParams变量。 package zyf.ManyColorME; /*导入要使用的包*/ import android.app.Activity; import android.graphics.Color; import android.os.Bundle; import android.widget.LinearLayout; import android.widget.TextView; public class ManyColorME extends Activity { /** Called when the activity is first created. */ /* 定义使用的对象 */ private LinearLayout myLayout; private LinearLayout.LayoutParams layoutP; private int WC = LinearLayout.LayoutParams.WRAP_CONTENT; private TextView black_TV, blue_TV, cyan_TV, dkgray_TV, gray_TV, green_TV,ltgray_TV, magenta_TV, red_TV, transparent_TV, white_TV, yellow_TV; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); /* 实例化一个LinearLayou

文档评论(0)

jiaoyuguanliji + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档