zoukankan      html  css  js  c++  java
  • 跑马灯效果

    activity类:

    public class MainActivity extends Activity {

    TextView text;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    text = (TextView)findViewById(R.id.textView1);
    text.setText("用户名");
    text.setTextColor(Color.RED);
    text.setText(Html.fromHtml("Hellodfrasdfsdfdsa<font color = red>Worfasdfsadfasdfasdld</font>"));

    /*SpannableString ss = new SpannableString("Hello World");
    ss.setSpan(new BackgroundColorSpan(Color.BLUE),0, 5, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
    text.setText(ss);*/
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
    }

    }

    XML文件:

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

    <TextView
    android:id="@+id/textView1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:ellipsize="marquee"
    android:focusable="true"
    android:focusableInTouchMode="true"
    android:singleLine="true"
    android:textSize="50dp"
    />


    </LinearLayout>

    奋斗和第三方
  • 相关阅读:
    SDWebImage
    ios面试题
    IOS推送功能push
    NSString什么时候用copy,什么时候用strong
    OC点语法和变量作用域
    iOS 常用几种数据存储方式
    JSON与XML的区别比较
    IOS开发——网络编程OC篇&Socket编程
    IOS-UI控件大全
    使用sql语句备份一张表
  • 原文地址:https://www.cnblogs.com/Smart-Du/p/4301967.html
Copyright © 2011-2022 走看看