• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
三三三
博客园    首页    新随笔    联系   管理    订阅  订阅

跑马灯

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:paddingTop="90dp"
    android:paddingLeft="16dp"
    android:paddingRight="16dp"
    tools:context="com.dream.dream.MainActivity"
    tools:showIn="@layout/activity_main">

    <com.dream.dream.Marquee
        android:focusableInTouchMode="true"
        android:focusable="true"
        android:singleLine="true"
        android:ellipsize="marquee"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/text_view" />
    <com.dream.dream.Marquee
        android:focusableInTouchMode="true"
        android:focusable="true"
        android:singleLine="true"
        android:ellipsize="marquee"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/text_view2" />
</LinearLayout>
package com.dream.dream;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextView;

/**
 * Created by dream on 2016/1/22.
 */
public class Marquee extends TextView {
    public Marquee(Context context) {
        super(context);
    }

    public Marquee(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public Marquee(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    public boolean isFocused() {
        return true;
    }
}

 

posted @ 2016-01-22 22:35  三三三  阅读(196)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3