简述:新增 TextView走马灯背景

遗留问题:
1.使用TextView实现走马灯效果需要TextView的Value值为长文本
2.走马灯是否是一直显示在首页
3.走马灯的关闭逻辑
This commit is contained in:
level 2024-07-30 10:40:48 +08:00
parent 6c06552d11
commit 0825af38a2
4 changed files with 36 additions and 15 deletions

View File

@ -514,10 +514,10 @@ class NewMainActivity : BaseActivity() {
private fun initMainPageHorseRaceLamp() {
val mainPageHorseRaceLamp=findViewById<TextView>(R.id.mainPageHorseRaceLamp)
val notice =
MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_NOTICE_READ, "暂无新通知")
MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_NOTICE_READ, R.string.noNewNotifications.toString())
val noticeIsRead =
MMKV.defaultMMKV().decodeString(BZYConstants.MMKV_KEY_NOTICE_DOWNLOAD_READ, "")
if(!notice.equals("暂无新通知")){
if(notice != R.string.noNewNotifications.toString()){
mainPageHorseRaceLamp.text=notice
mainPageHorseRaceLamp.requestFocus()
mainPageHorseRaceLamp.marqueeRepeatLimit = Integer.MAX_VALUE

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient android:startColor="#00DFB786" android:centerColor="#66DFB786"
android:endColor="#00DFB786" />
</shape>

View File

@ -69,21 +69,35 @@
<!-- android:text="点我充值"-->
<!-- android:textColor="@color/white" />-->
<com.yingmao.clash.util.MarqueeTextView
android:id="@+id/mainPageHorseRaceLamp"
android:layout_width="wrap_content"
<LinearLayout
android:id="@+id/llNoticeBackground"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:scrollHorizontally="true"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
android:layout_below="@+id/ll_activity"
android:layout_toStartOf="@+id/ll_activity"
android:padding="10dp"
android:textColor="@color/white"
/>
android:layout_marginEnd="30dp"
android:layout_marginStart="30dp"
android:orientation="horizontal"
android:background="@drawable/shape_notice_background"
android:gravity="center"
>
<com.yingmao.clash.util.MarqueeTextView
android:id="@+id/mainPageHorseRaceLamp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:scrollHorizontally="true"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
android:padding="10dp"
android:textColor="@color/white"
android:text=""
android:textSize="17sp"
android:layout_marginEnd="50dp"
android:layout_marginStart="50dp"
/>
</LinearLayout>
</RelativeLayout>
<LinearLayout

View File

@ -386,4 +386,5 @@
</p>
]]>
</string>
<string name="noNewNotifications">暂无新通知</string>
</resources>