Android学习(二) 标签滚动跳过
<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=".MainActivity" > <com.example.marqueetextview.MarqueeText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:text="@string/hello_world" /> <com.example.marqueetextview.MarqueeText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:singleLine="true"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:text="@string/hello_world" /> </RelativeLayout>
后台实现:
public class MarqueeText extends TextView{
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
}
public MarqueeText(Context context) {
super(context);
// TODO Auto-generated constructor stub
}
@Override
@ExportedProperty(category = "focus")
public boolean isFocused() {
//继承TextView类,重写isFocused方法,返回true,因为marquee只有在当前控件获取焦点时才会滚动。
return true;
}
}
Android学习(二) 标签滚动跳过的更多相关文章
- Android学习——uses-sdk标签详解
1 前言 我们都知道,Android的版本在不断的迭代,并且每个版本都加入了不同的新特性.那么随着Android的用户量越来越多,Android的开发人员就必须熟悉Android各个版本的特性并且确保 ...
- Android学习二_八:Animation的使用(一) (转)
一.Animations介绍 Animations是一个实现android UI界面动画效果的API,Animations提供了一系列的动画效果,可以进行旋转.缩放.淡入淡出等,这些效果可以应用在绝大 ...
- Android学习手记(1) Activity跳转
新建Project,并将主页命名为MainActivity. 创建一个Activity 在App上“右键->New->Activity->Empty Activity”, 将新建的A ...
- Android学习二:Http操作
1.初步认识HTTP HTTP(Hypertext Transfer Protocol超文本传输协议)是网络应用层协议,建立在TCP/IP基础上,HTTP使用可靠的TCP连接,默认端口是80. 较常用 ...
- android学习二(Activity)
前面我简单的介绍了android的一些基础知识,当作热身吧,接下来接触android的四大组件的activity活动. 1.活动Activity是是一种保护用户界面的组件,主要用于和用户进行交互. 活 ...
- android学习二---解决ADT Buddle无法自动生成layout和res
开发环境: 1)windows 7 64位 2)adt-bundle-windows-x86_64-20140624 3)Android Development Toolkit Version: 23 ...
- openfire Android学习(二)----对分组、好友和头像等一些操作
一.查询所有分组 通过Roster来获取所有分组,Roster可以通过connection.getRoster()来得到. [java] view plaincopy /** * 获取所有组 * * ...
- Android JNI学习(二)——实战JNI之“hello world”
本系列文章如下: Android JNI(一)——NDK与JNI基础 Android JNI学习(二)——实战JNI之“hello world” Android JNI学习(三)——Java与Nati ...
- 【转】 Pro Android学习笔记(二二):用户界面和控制(10):自定义Adapter
目录(?)[-] 设计Adapter的布局 代码部分 Activity的代码 MyAdapter的代码数据源和构造函数 MyAdapter的代码实现自定义的adapter MyAdapter的代码继续 ...
随机推荐
- tips 前端 点击事件
新手总是时不时会纠结一下 点击事件 我们都知道这些小东西不难 但是偶尔难道不会想想我们可能对这些即使小kiss的问题的认知其实不够清晰 一个认识不清晰的东西使用时 总会有油然而生的不安感 从而用的不放 ...
- Java并发编程--AQS
概述 抽象队列同步器(AbstractQueuedSynchronizer,简称AQS)是用来构建锁或者其他同步组件的基础框架,它使用一个整型的volatile变量(命名为state)来维护同步状态, ...
- .net 网站首页,本次的项目中用到的一个网站首页中统计网页访问量的工具方法,我觉得它应该在pagebase里面,拿来用一下
需要建立一个根文件夹 ~/xml/couter.txt #region 网站访问量 protected void pageviews() { int count ...
- USACO silver P1
原题概述题意: 共有N个数,每个数的个数为ai,ai的总和为M,将每2个数进行配对,要求使配对之后2数的和的最大值最小,并输出最小值. 这不就是裸的贪心么..实在是水题啊, 不过如果假如有一个人要一个 ...
- shell编程学习笔记【原创】
本文为本人学习笔记,如有转载请注明出处,谢谢 一.Bourne Shell 有如下四种变量: 用户自定义变量 位置变量,即命令行参数 预定义变量 环境变量 二.位置变量 $ 与键入的命令行一样,包含脚 ...
- HDU5469 Antonidas(树分治&&哈希)
给你一颗点上有字符的树,问一个给定的字符串是否是这棵树上的两点的路径. 树分治的思想就是每次找重心,重心下的子问题分解去做,然后就是合并了.合并的时候用一个总的set<pair<len,h ...
- os.path.isfile的错误
今天写了一个程序,读取子目录(source)下的所有文件,然后转换. 程序一部分代码如下: def DtoTab(dsrc, dtarget): try: for item in os.listdir ...
- poj 1873(枚举所有的状态+凸包)
The Fortified Forest Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 6115 Accepted: 1 ...
- AC日记——Little Elephant and Array codeforces 221d
221D - Little Elephant and Array 思路: 莫队: 代码: #include <cmath> #include <cstdio> #include ...
- Knockout 双向绑定的理解
今天做了个需求就是上传图片,然后在代码中通过jQuery给一个标签赋值,经过前台的debug,发现这个值赋值成功了,但是提交到后台的请求里就没了,然后经历了一顿度娘,结果中发现了问题. 既然knock ...