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

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

  1. 1、本文档共19页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
  5. 5、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
  6. 6、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们
  7. 7、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
  8. 8、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
新版Androi开发教程笔记七--基础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 利用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 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 ; /* 实例化一个LinearLayout布局对象 */ myLayout new LinearLayout this ; /* 设置LinearLayout的布局为垂直布局 */ myLayout.setOrientation LinearLayout.VERTICAL ; /* 设置LinearLayout布局背景图片 */ myLayout.setBackgroundResource R.drawable.back ; /* 加载主屏布局 */ setContentView myLayo

文档评论(0)

ikangdwe + 关注
实名认证
文档贡献者

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

1亿VIP精品文档

相关文档