Android 开发笔记___textvieww__跑马灯效果
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical" android:layout_width="match_parent"
- android:layout_height="match_parent">
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="演示效果"
- android:textColor="@color/text_color"
- android:textSize="25sp"
- android:layout_gravity="center"/>
- <LinearLayout
- android:layout_width="match_parent"
- android:orientation="vertical"
- android:layout_height="250dp">
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="20dp"
- android:gravity="center"
- android:text="跑马灯效果,点击暂停,再点击恢复"/>
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:id="@+id/tv_marquee"
- android:layout_marginTop="20dp"
- android:singleLine="true"
- android:ellipsize="marquee"
- android:focusable="true"
- android:focusableInTouchMode="true"
- android:textColor="#000000"
- android:textSize="17sp"
- android:text="快讯:红色预警,超高温度即将到来,请吐鲁番居民关紧门窗、备足粮草,打开空调,做好防汛救灾准备!"/>
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="聊天室效果"
- android:layout_marginTop="10dp"
- android:id="@+id/btn_liaotianshi"/>
- </LinearLayout>
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="主要内容"
- android:textColor="@color/text_color"
- android:textSize="25sp"
- android:layout_gravity="center"/>
- <ScrollView
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
- <TextView
- android:textColor="@color/text_color"
- android:text="1.跑马灯效果\n首先设置为单行(singleline),再设置超出范围后的省略方式(有三种:1、start 2、middle 3、end ,当设置为marquee时就是跑马灯效果)。还需要获取焦点,设置focusable=true,focusableInTouchMode=true\n\n2、聊天室效果\nscrollbars是vertical,在代码中设置set movementmethod"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content" />
- </ScrollView>
- </LinearLayout>
java
- package com.example.alimjan.hello_world;
- import android.app.Activity;
- import android.content.Context;
- import android.content.Intent;
- import android.os.Bundle;
- import android.support.annotation.Nullable;
- import android.view.View;
- import android.widget.Button;
- /**
- * Created by alimjan on 6/30/2017.
- */
- public class class__2_3_1 extends Activity {
- private Button lts;
- @Override
- protected void onCreate(@Nullable Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.code_2_3_1);
- lts = (Button) findViewById(R.id.btn_liaotianshi);
- lts.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- Intent intent = new Intent(class__2_3_1.this, class__2_3_1_2.class);
- class__2_3_1.this.startActivity(intent);
- }
- });
- }
- public static void startHome(Context mContext) {
- Intent intent = new Intent(mContext, class__2_3_1.class);
- mContext.startActivity(intent);
- }
- }
Android 开发笔记___textvieww__跑马灯效果的更多相关文章
- Android 使用TextView实现跑马灯效果
前言 我们在开发中经常会遇到一个小问题.比如下面一个小例子: 这个文字太长,单行中导致无法全部显示出来,这就是今天要实现的功能. 当然,百度中也有很多这种解决方案. 其中有一种,例如: <Tex ...
- Android学习总结——TextView跑马灯效果
Android系统中TextView实现跑马灯效果,必须具备以下几个条件: 1.android:ellipsize="marquee" 2.TextView必须单行显示,即内容必须 ...
- Android使用TextView实现跑马灯效果(自定义控件)
对于一个长的TetxView 折行显示是一个很好的办法,另一种方法就是跑马灯显示(单行滚动) 1.折行显示的长TextView <LinearLayout xmlns:android=" ...
- android用TextView实现跑马灯效果
今天搞啦很久,其实很简单,就加几个属性就可以啦! 图如下 : 有的说要重写TextView方法,有的说要设置固定长度,但是我没重写也没有设置固定长度也弄出来啦!跑在2.3.3的手机上面.就是不知道其他 ...
- Android 开发笔记___textview_聊天室效果
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=&quo ...
- Android 用ViewFlipper实现跑马灯效果的公告提示
1.代码部分private void initViewFlipper(final HomepageListModel.Notice notice) { for (int i = 0; i < n ...
- Android开发:文本控件详解——TextView(二)文字跑马灯效果实现
一.需要使用的属性: 1.android:ellipsize 作用:若文字过长,控制该控件如何显示. 对于同样的文字“Android开发:文本控件详解——TextView(二)文字跑马灯效果实现”,不 ...
- TextView的跑马灯效果(AS开发实战第二章学习笔记)
TextView的跑马灯效果跑马灯用到的属性与方法说明singleLine 指定文本是否单行显示ellipsize 指定文本超出范围后的省略方式focusable 指定是否获得焦点,跑马灯效果要求设置 ...
- android中实现跑马灯效果以及AutoCompleteTestView与MultiAutoCompleteTextView的学习
跑马灯效果 1.用过属性的方式实现跑马灯效果 属性: android:singleLine="true" 这个属性是设置TextView文本中文字 ...
随机推荐
- springmvc 格式化返回日期格式
<mvc:annotation-driven conversion-service="conversionService"> <mvc:message-conve ...
- Java虚拟机-运行时数据区域
Java虚拟机管理的内存包括如图所示的运行时数据区域: 下面分别进行介绍: 1)程序计数器(Program Counter Register) 占用的内存空间比较小,主要作用就是标识当前线程执行的字节 ...
- UI自动化测试(二)浏览器操作及对元素的定位方法(xpath定位和css定位详解)
Selenium下的Webdriver工具支持FireFox(geckodriver). IE(InternetExplorerDriver).Chrome(ChromeDriver). Opera( ...
- CSS中新属性calc()
CSS3的calc()使用 原文: http://www.w3cplus.com/css3/how-to-use-css3-calc-function.html © w3cplus.com calc( ...
- win2003服务器定时自动重启命令
1. win2003可以这样自动重启: 新建一个命令行文件比如reboot.bat 内容如下:shutdown -r -t 30 在计划任务中新建一个任务,程序选择上面这个reboot.cmd文件,时 ...
- IIS ApplicationPoolIdentity(配置IIS讀寫網站文件)
原创地址:http://www.cnblogs.com/jfzhu/p/4067297.html 转载请注明出处 从IIS 7.5开始,Application Pool Identity的Built- ...
- win10 uwp 通知Toast
win10通知使用Toast 可以使用win10 模板添加通知 var t = Windows.UI.Notifications.ToastTemplateType.ToastText02; 使用Ge ...
- 张高兴的 Windows 10 IoT 开发笔记:红外温度传感器 MLX90614
GitHub : https://github.com/ZhangGaoxing/windows-iot-demo/tree/master/MLX90614
- OpenWRT (RT5350) 使能两个串口
OpenWRT(RT5350) 默认使能一个串口(uartlite) ,当做console口了,另外一个串口(uartf)与gpio复用. 在查找资料的过程中,发现在新的内核中使用到了设备树(devi ...
- (转)十分钟入门pandas
本文是对pandas官方网站上<10 Minutes to pandas>的一个简单的翻译,原文在这里.这篇文章是对pandas的一个简单的介绍,详细的介绍请参考:Cookbook . 习 ...