Android_TextVIew_flow_ex1
xml文件:
<RelativeLayout 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="com.example.app6.MainActivity" > <com.example.TextView_flow.marqueeText
android:id="@+id/textView_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world"
android:singleLine="true"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"/>
<!-- TextView可以用其子类来声明,子类的表现形式是包名+类名
设置4条语功能语句才能实现跑马灯的效果-->
<com.example.TextView_flow.marqueeText
android:layout_below="@id/textView_1"
android:layout_marginTop="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world"
android:singleLine="true"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"/> </RelativeLayout>
marqueeText.java
package com.example.TextView_flow; import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextView; public class marqueeText extends TextView{ public marqueeText(Context context) {
super(context);
// TODO Auto-generated constructor stub
} public marqueeText(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
// TODO Auto-generated constructor stub
} public marqueeText(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
}
/*
* 复写这个方法是第一个文本框得到了可聚焦为true的方法,以跑马灯形式显示,而其他文本框得不到
*/
@Override
public boolean isFocused() {
return true;
}
}
源代码:
package com.example.TextView_flow; import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem; public class MainActivity extends Activity { @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
Android_TextVIew_flow_ex1的更多相关文章
随机推荐
- TCP 3次握手和四次挥手
1.标示符说明 位码即tcp标志位: SYN(synchronous建立联机) ACK(acknowledgement 确认) PSH(push传送) FIN(finish结束) ...
- windows内核初窥(二)-----系统机制
系统机制: windows2000为执行体.内核.设备驱动程序等核心态部分提供了一些基础机制.先让我们看看都有哪些: (1)陷阱调度:包括中断.延迟过程调用(DPC).异步过程调用(APC).异常处理 ...
- AIDL:Binder invocation to an incorrect interface
Android进程之间通信异常:主要原因是客户端的aidl文件和与远程调用的Service的aidl文件包名不同 处理方式一般就是在客户端要一个与远程暴露出来的接口包名要一致 服务端: 客户端:
- leetcode@ [139/140] Word Break & Word Break II
https://leetcode.com/problems/word-break/ Given a string s and a dictionary of words dict, determine ...
- Django中的Model(字段)
Model Django中的model是用来操作数据库的,Model是一个ORM框架,我们只需要关心model的操作,而不需要关心到底是哪一种数据库. 一.基本知识: 数据库引擎: Django中自带 ...
- Oracle-Oracle10 数据空间建立,导入,导出--oracle10g 删除步骤
--以system/manager身份登录SQLPlus,并执行 ========================管理员登陆==================================== 登 ...
- 常用 Unicode 符号列表
Unicode 中包含了各种符号,我们可以作为图标来使用.这里整理一下常用的一些符号. 一.拉丁字母补全(Latin-1 Supplement):U+0080 至 U+00FF Unicode 编号 ...
- 升级到tomcat7.0碰到的问题
今天把tomcat从6.0.18升级到7.0.25,发现了两个问题 问题1 java.lang.ClassNotFoundException: org.apache.catalina.mbeans.S ...
- Win8.1激活
激活查询:在桌面状态下输入“Win+R”,进入运行栏目,输入slmgr.vbs -dlv 显示:最为详尽的激活信息,包括:激活ID.安装ID.激活截止日期 http://www.nruan.com/w ...
- 博客转移到lyso.me
博客转移到http://lyso.me :)