zoukankan      html  css  js  c++  java
  • [一] TextView

    //Alt + ?实现代码的自动补全
    //res/values/strings.xml  目录下面实现类似于c++的宏定义
    <string name="hello">Hello  Notebook!!</string>
    
    <TextView android:text="@string/hello" />//显示的是调用的内容
    android:textSize="20sp" //字体大小用sp作为单位,宽度,高度用dp
    android:textColor="#00FF00"//设置字体颜色为绿色
    android:id="tv"  //定义控件的id
    
    TextView tv=(TextView)findViewById(R.id.tv);
    String str="欢迎大家!!这个是一个textview的演示!! ";
    SpannableStringBuilder style=new SpannableStringBuilder(str);
    style.setSpan(new ForegroundColorSpan(Color.RED), 0, 6, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    style.setSpan(new ForegroundColorSpan(Color.GREEN), 6, 21, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    style.setSpan(new ForegroundColorSpan(Color.BLUE), 21, 34, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    tv.setText(style);
    //设置TextView的局部显示的颜色和显示的内容
    
    设置超链:可以包括web的博客访问和phone num等。
    
    android:autoLink="web" //设置web访问,同理phone等也可以有下滑线
    //跑马灯效果
    android:singleLine="true" //文字单行显示,不可缺
    android:focusable="true"
    android:ellipsize="marquee"
    android:marqueeRepeatLimit="marquee_forever"
    android:focusableInTouchMode="true"
    View Code
  • 相关阅读:
    meta标签中的http-equiv属性使用介绍
    MySQL中批量执行SQL语句
    <fmt:formatNumber/>显示不同地区的各种数据格式
    <fmt:setBundle/>标签
    <fmt:bundle/>、<fmt:message/>、<fmt:param/>资源国际化
    <fmt:setTimeZone/>设置时区
    <fmt:timeZone/>显示全球时间
    初识Storm
    storm安装及启动
    HBase API 的使用(一)
  • 原文地址:https://www.cnblogs.com/zhang1107/p/3092725.html
Copyright © 2011-2022 走看看