初识安卓
来源:互联网 发布:js阻止事件冒泡 编辑:程序博客网 时间:2024/05/23 19:13
package com.example.hellowidgets;import android.os.Bundle;import android.app.Activity;import android.graphics.Bitmap;import android.graphics.BitmapFactory;import android.text.Html;import android.text.Spannable;import android.text.SpannableString;import android.text.style.DynamicDrawableSpan;import android.text.style.ImageSpan;import android.view.Menu;import android.widget.TextView;public class MaaaaActivity extends Activity {@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_maaaa);TextView tv=(TextView) findViewById(R.id.textView12);tv.setTextSize(20);tv.setText("\n菜鸟思密达");tv.setBackgroundColor(34);//html文本TextView tv1=(TextView) findViewById(R.id.htmltextview);String html="我是html字符串
超级链接百度";tv1.setText(Html.fromHtml(html));//图文混排Bitmap b=BitmapFactory.decodeResource(getResources(),R.drawable.miedao );ImageSpan imgSpan=new ImageSpan(this,b,DynamicDrawableSpan.ALIGN_BOTTOM);SpannableString spanString=new SpannableString("icon");spanString.setSpan(imgSpan, 0, 4, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);TextView tv2=(TextView) findViewById(R.id.htmltextview);tv2.setText("图文混排");tv2.append(spanString);tv2.append("我是追加文本");}@Overridepublic boolean onCreateOptionsMenu(Menu menu) {// Inflate the menu; this adds items to the action bar if it is present.getMenuInflater().inflate(R.menu.maaaa, menu);return true;}}
超级链接百度";tv1.setText(Html.fromHtml(html));//图文混排Bitmap b=BitmapFactory.decodeResource(getResources(),R.drawable.miedao );ImageSpan imgSpan=new ImageSpan(this,b,DynamicDrawableSpan.ALIGN_BOTTOM);SpannableString spanString=new SpannableString("icon");spanString.setSpan(imgSpan, 0, 4, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);TextView tv2=(TextView) findViewById(R.id.htmltextview);tv2.setText("图文混排");tv2.append(spanString);tv2.append("我是追加文本");}@Overridepublic boolean onCreateOptionsMenu(Menu menu) {// Inflate the menu; this adds items to the action bar if it is present.getMenuInflater().inflate(R.menu.maaaa, menu);return true;}}
0 0
- 初识安卓
- 初识安卓
- 初识安卓-打招呼
- 初识安卓
- 安卓初识控件_DatePicker
- 安卓线程Thread初识
- Android学习系列(一)初识安卓
- 初识安卓基本控件_ImageView
- 初识安卓基本控件_tablelayout
- 初识安卓基本控件_girdlayout
- 初识安卓基本控件_EditText
- 初识安卓基本控件_TimePicker
- 安卓初识基本控件_ProgressBar
- 安卓初识基本控件_SeekBar
- 安卓初识基本控件_RatingBar
- 安卓初识基本控件_ToggleButton
- 安卓初识基础控件_CheckBox
- 安卓初识基本控件_RadioGroup&RadioButton
- 思乡的情绪
- Android 4.3 中的 TRIM 优化
- Func,Action 的介绍及其用法
- 【BZOJ】【P3039】【玉蟾宫】【题解】【悬线法】
- NYOJ116 士兵杀敌(二)(树状数组)
- 初识安卓
- 解决session过期跳转到登陆页面并跳出iframe框架
- GCC内建函数__builtin_constant_p
- button
- C++实现链式二叉树,采用非递归的方式先序,中序,后序遍历二叉树
- toast
- row_number() over(partition by col1 order by col2)的用法
- XML 说明
- 为什么学习Python及Python环境安装