gpt4 book ai didi

android - 如何在 SeekBar 拇指中间添加 TextView?

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:34:58 31 4
gpt4 key购买 nike

<分区>

我在 Android 中工作。我想制作一个 SeekBar。在 SeekBar 的拇指中,我想显示进度(可能在 TextView 上与拇指对齐并随拇指移动)。

这是我为 SeekBarTextView 编写的 XML

<SeekBar
android:id="@+id/ProgressBar01"
android:layout_width="fill_parent"
android:paddingLeft="10px"
android:paddingRight ="10px"
android:layout_height="70dp"
android:layout_below="@+id/incentives_textViewBottemLeft"
android:max="10"
android:progressDrawable="@drawable/incentive_progress"
android:secondaryProgress="0"
android:thumb="@drawable/incentives_progress_pin"
android:focusable="false" />

<TextView
android:id="@+id/incentives_textViewAbove_process_pin"
android:layout_width="fill_parent"
android:layout_height="20dp"
android:layout_below="@+id/incentives_textViewBottemLeft"
android:layout_marginTop="11dp"
android:text=""
android:textStyle="bold"
android:textColor="#FFe4e1"
android:textSize="15sp" />

这是我用来对齐文本的代码

int xPos = ((mSkbSample.getRight() - mSkbSample.getLeft()) / mSkbSample.getMax()) * mSkbSample.getProgress();
v1.setPadding(xPos+m,0,0,0);
v1.setText(String.valueOf(progress).toCharArray(), 0, String.valueOf(progress).length());

但文本未显示到该拇指的中心。请建议我应该为此做什么。

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com