一、实现图

二、代码

2.1   xml

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"><TextViewandroid:id="@+id/view0"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_gravity="center"android:background="#ff0000"android:height="200dp"android:width="200dp" /><TextViewandroid:id="@+id/view1"android:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_gravity="center"android:background="#ff00ff"android:height="180dp"android:width="180dp" /><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:layout_gravity="center"android:width="160dp"android:height="160dp"android:background="#bb0000"android:id="@+id/view2"/><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:width="140dp"android:height="140dp"android:layout_gravity="center"android:background="#990000"android:id="@+id/view3"/><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:width="120dp"android:height="120dp"android:layout_gravity="center"android:background="#770000"android:id="@+id/view4"/><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:width="100dp"android:height="100dp"android:layout_gravity="center"android:background="#550000"android:id="@+id/view5"/><TextViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:width="80dp"android:height="80dp"android:layout_gravity="center"android:background="#330000"android:id="@+id/view6"/><com.example.myapplication.MyTextViewandroid:id="@+id/title1"android:layout_width="match_parent"android:layout_height="match_parent"android:ellipsize="marquee"android:focusable="true"android:focusableInTouchMode="true"android:marqueeRepeatLimit="marquee_forever"android:singleLine="true"android:text="@string/app_name"android:textColor="@color/color1"android:textSize="75sp"android:textStyle="bold" /></FrameLayout>

2.2  java

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.widget.TextView;public class MainActivity extends Activity {final int[] colors = new int[]{R.color.color7,R.color.color6,R.color.color5,R.color.color4,R.color.color3,R.color.color2,R.color.color1,};final int[] names = new int[]{R.id.view0,R.id.view1,R.id.view2,R.id.view3,R.id.view4,R.id.view5,R.id.view6,};TextView view[] = new TextView[7];class MyHandler extends Handler {int i = 0;public void handleMessage(Message msg) {i++;if (i >= 6) {i = 1;}for (int m = 7 - i, n = 0; m < 7; m++, n++) {view[m].setBackgroundResource(colors[n]);}for (int m = 0; m < 7 - i; m++) {view[m].setBackgroundResource(colors[m + i]);}sleep(100);}public void sleep(int j) {sendMessageDelayed(obtainMessage(0), j);}}public void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);for (int i = 0; i < 7; i++) {view[i] = findViewById(names[i]);}final MyHandler myHandler = new MyHandler();myHandler.sleep(100);}}
import android.annotation.SuppressLint;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextView;import androidx.annotation.Nullable;@SuppressLint("AppCompatCustomView")
public class MyTextView extends TextView {public MyTextView(Context context) {super(context);}public MyTextView(Context context, @Nullable AttributeSet attrs) {super(context, attrs);}public MyTextView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {super(context, attrs, defStyleAttr);}public boolean isFocused() {return true;}
}

【Android】 炫酷霓虹灯相关推荐

  1. Android炫酷的3D球型标签云开源库 3dTagCloudAndroid 的使用

    Android炫酷的3D球形标签云开源库 3dTagCloudAndroid 的使用 文章目录 Android炫酷的3D球形标签云开源库 3dTagCloudAndroid 的使用 学习过程 使用体会 ...

  2. android 炫酷进度条,Android打造炫酷进度条效果

    本文实例为大家分享了Android炫酷进度条效果的具体代码,供大家参考,具体内容如下 HorizontalProgressbarWithProgress的代码 import android.conte ...

  3. android炫酷的自定义view,Android自定义View实现炫酷进度条

    本文实例为大家分享了Android实现炫酷进度条的具体代码,供大家参考,具体内容如下 下面我们来实现如下效果: 第一步:创建attrs文件夹,自定义属性: 第二步:自定义View: /** * Cre ...

  4. android 炫酷背景,炫酷-背景图垂直循环滚动登录页,Android RecyclerView实现

    炫酷-背景图上下循环滚动登录页,Android RecyclerView实现方法 某站的登录页背景不停循环滚动,和街边的广告箱很像,感觉不错我也心动了.决定高仿一下,参考了几篇文章后就动手了. 实现步 ...

  5. android炫酷动画代码,Android高级UI特效仿直播点赞动画效果

    Android高级UI特效仿直播点赞动画效果 发布时间:2020-10-02 16:06:18 来源:脚本之家 阅读:117 作者:mrr 本文给大家分享高级UI特效仿直播点赞效果-一个优美炫酷的点赞 ...

  6. android 炫酷 图片背景,炫酷-背景图垂直循环滚动登录页,Android RecyclerView实现

    炫酷-背景图上下循环滚动登录页,Android RecyclerView实现方法 某站的登录页背景不停循环滚动,和街边的广告箱很像,感觉不错我也心动了.决定高仿一下,参考了几篇文章后就动手了. 实现步 ...

  7. Android 炫酷动画APP,21 款炫酷动画开源框架,照亮你的APP

    原标题:21 款炫酷动画开源框架,照亮你的APP 2017年安卓巴士全球开发者论坛-上海站 前言 最近对应用的UI视觉效果突然来了兴致,所以找了一些合适开源控件,这样更加省时,再此分享给大家,希望能对 ...

  8. Android炫酷效果集锦

    安卓开发中非常炫的效果集合 这几天开发的时候,想做一些好看而且酷炫的特效,于是又开始从网上收集各种特效资源.下面给大家一些我喜欢的把,附代码,喜欢的看源代码,然后加到自己项目去把!! 一个开源项目网站 ...

  9. android炫酷效果集合

    这几天开发的时候,想做一些好看而且酷炫的特效,于是又开始从网上收集各种特效资源.下面给大家一些我喜欢的把,附代码,喜欢的看源代码,然后加到自己项目去把!! 一个开源项目网站有很多炫酷效果  http: ...

  10. android打开小屏登录画面,Android炫酷登录界面

    来看一波图片吧 CoverEyeLogin.gif 动画效果介绍 1.当用户输入用户名时,小猫头鹰的眼睛是没有被捂住的 2.当用户输入密码时,小猫头鹰会用手捂住眼睛 3.如果用户名和密码都已经输入完毕 ...

最新文章

  1. Ubuntu 16.04 安装后修改屏幕分辨率(xrandr: Failed to get size of gamma for output default)
  2. oracle与mysql创建表时的区别
  3. python判断图片模糊
  4. 记一次EventBus内存泄露导致的项目问题
  5. 在WAS中得到OracleConnection
  6. 下面的语言中哪些语言是动态语言( )
  7. 基本类型赋值和普通对象赋值的不同
  8. Python-将一个列表的数据复制到另一个列表中
  9. 暴风集团仅剩10余人;搜狗告百度输入法侵权案再驳回;Linux 5.6发布 | 极客头条...
  10. Arrays.copyOf()方法详解-jdk1.8
  11. 十年PHP架构师的成长之路,程序员必备
  12. java实现生命游戏(2维元胞自动机)
  13. 【风马一族_Android】 图能
  14. studio 3t 如何链接开启验证的mongodb
  15. php 正方,用php的CURL模拟登录正方教务系统
  16. centos英文版下如何安装中文语言
  17. 071-JAVA项目实训:仿QQ即时通讯软件系列讲座六(讲解QQ主界面功能)
  18. Salesforce系列(0):Salesforce注册开发者账号!
  19. 无星的RN学习之旅(六)-第三方App跳转,苹果商店跳转,loading框
  20. HDHCMS模板建立与栏目绑定的方法

热门文章

  1. 新概念1 课文和单词(2022/12/23)
  2. 我写的破代码将被保存1000年?GitHub启动代码永久存储计划
  3. O准备如何苟进复赛圈?华为软挑开挂指南(附赛题预测)
  4. 以下对python程序设计风格_以下对 Python 程序设计风格描述正确的选项是( )
  5. 3-10月 -06摘录
  6. Nervos:链外扩容 + Layer 2才是区块链的未来(下)
  7. PBox 基于 Dll 动态库窗体的模块化开发平台 (已开源)
  8. 大数据学习之路一(大数据概念、特点、应用场景)
  9. 工大助手电费查询接口讲解
  10. 如何从容迎接人工智能时代的到来?让我们听听专家的解读