【发布时间】:2021-08-12 17:21:18
【问题描述】:
我的 Android 应用中有一个自定义的 SeekBar。当拇指按下时,周围会出现一种光晕。长时间按下时,光环也会改变。我想消除这种光环效应。
我查看了这个 SeekBar 文档https://developer.android.com/reference/android/widget/SeekBar.html,但没有看到任何可以消除它的东西。
所以,我的问题是:如何在按下搜索栏拇指时禁用这种“光环”效果?
在这个截图中,你可以看到我试图消除的白色光晕。
提前致谢!
编辑:添加 SeekBar xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/clip_connect_list_item"
android:layout_width="fill_parent"
android:layout_height="@dimen/list_item_radius"
android:background="@drawable/slider_base"
android:orientation="horizontal"
android:clickable="true">
<SeekBar android:id="@+id/seekBar1"
android:max="100"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:thumbOffset="0dp"
android:layout_gravity="center_vertical"
android:progressDrawable="@color/transparent"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:paddingTop="0dp"
android:paddingBottom="0dp"
>
</SeekBar>
</LinearLayout>
【问题讨论】:
-
让我猜猜,只要按住搜索栏,光环就会增长。我说的对吗?
-
不完全。似乎使用了两层“光环”。第一次按下拇指时,它看起来像屏幕截图。长按后,第二层会增长/动画出拇指图像,直到第一个光环的边界,所以光环看起来稍微不透明。
-
你能把你的 Seekbar 的 xml 贴出来吗?
-
研究更多,我猜这种行为是从主题继承的。我刚刚尝试将应用程序样式从“Theme.AppCompat”切换到“Theme.AppCompat.Light.DarkActionBar”,光环的颜色从白色变为一种半透明的黑色。所以,我想现在的问题是,我要修改主题的哪个属性?
-
我猜是选择器,如果我没记错是涟漪效应,看看告诉我