android - 如果“高度”设置为 2dp 或低于“wrap_content”,SeekBar 不显示完整的“拇指图标”
问题描述
在我的应用程序中,我使用带有自定义“拇指图标”和自定义“颜色”的 SeekBar。根据要求,我将其高度设置为 2dp,但在这种情况下,SeekBar 未显示完整的“拇指图标”,当我将其高度设置为“wrap_content”时,它显示完整的“拇指图标”,但它也增加了进度线高度超出预期。下面是清楚地解释我的问题的图像,请检查 -
下面是我的xml代码——
activity_seek_bar.xml
<RelativeLayout 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:background="@android:color/white"
android:layout_height="match_parent"
tools:context=".Activity.SeekBarTestActivity">
<SeekBar
android:id="@+id/seekBar1"
android:layout_width="match_parent"
android:thumb="@drawable/sb_pointer"
android:splitTrack="false"
android:progress="50"
android:progressDrawable="@drawable/progress_drawable"
android:layout_height="wrap_content"
android:layout_marginTop="90dp" />
</RelativeLayout>
progress_drawable.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<solid
android:color="#3a3a3a" />
</shape>
</item>
<item
android:id="@android:id/progress">
<clip>
<shape>
<solid
android:color="@color/media_action_color" />
</shape>
</clip>
</item>
</layer-list>
我做了很多谷歌搜索,但不幸的是到目前为止没有结果,这就是为什么我需要你们专家的一些指导。另外,请让我知道我是否可以提供更多详细信息。谢谢你。
解决方案
use
android:layout_height="wrap_content"
android:maxHeight="2dp"
推荐阅读
- android - 如何解决 kotlin cacheconfig 错误
- java - 如何拆分包含 apache camel 中文件列表的交换并将每个文件写入文件系统
- php - Wordpress 中同一个 css 中的多个类
- javascript - Fullcalendar : 为事件显示错误的结束时间
- javascript - 带有firebase计时问题的javascript
- google-apps-script - 改善从 Google 表格发送电子邮件之前所需的条件
- pdfbox - PDFBox:通过重复添加包含表单的单页模板来填写 PDF
- batch-file - 递归重命名在批处理中根本不起作用
- android - AndroidPlot 获取直线的 Y 位置
- json - 通过 url 获取 queryparams (JSON) - Angular 5