Android   发布时间:2022-04-28  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了android – cant把拇指放在搜索栏的中心大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我想知道如何将拇指设置在搜索栏的中心.
不知道如何表达,所以我将添加图片链接.
一个img是设计指南的搜索栏,下面是我的搜索栏.

(忽略角落.我在捕获imgs后修复了.)
起初,从设计师那里,我得到了两个单独的img文本,无论好坏.所以我结合了那些.我以为它会像拇指一样工作.但现在我得到的是这些结果……请帮帮我..谢谢!

drawable:progressbar_goodbad xml

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://scheR_774_11845@as.android.com/apk/res/android">
<item android:id="@android:id/BACkground">
    <shape>
        <gradient
            android:startColor="#f5c0bd"
            android:centerColor="#f5c0bd"
            android:centerY="0.75"
            android:endColor="#f5c0bd"
            android:angle="270"/>
        <padding android:left="10dp"
            android:top="1dp"
            android:right="10dp"
            android:bottom="1dp"/> 
    <corners
        android:bottomRighTradius="10dp"
        android:bottomLefTradius="10dp"
        android:topLefTradius="10dp"
        android:topRighTradius="10dp"/>
</shape>
</item>
<item android:id="@android:id/secondaryProgress">
<clip>
    <shape>
        <gradient
            android:startColor="#234"
            android:centerColor="#234"
            android:centerY="0.75"
            android:endColor="#a24"
            android:angle="90"/>
        <padding android:left="1dp"
            android:top="1dp"
            android:right="1dp"
            android:bottom="1dp"/> 
    <corners
        android:bottomRighTradius="10dp"
        android:bottomLefTradius="10dp"
        android:topLefTradius="10dp"
        android:topRighTradius="10dp"/>
        </shape>
</clip>
</item>
<item android:id="@android:id/progress">
<clip>
   <shape>
        <gradient
            android:startColor="#fc9a94"
            android:centerColor="#fc9a94"
            android:centerY="0.75"
            android:endColor="#fc9a94"
            android:angle="90"/>
        <padding android:left="1dp"
            android:top="1dp"
            android:right="1dp"
            android:bottom="1dp"/> 
    <corners
        android:bottomRighTradius="10dp"
        android:bottomLefTradius="10dp"
        android:topLefTradius="10dp"
        android:topRighTradius="10dp"/>
    </shape>
</clip>
</item>
</layer-list>

主要布局xml的一部分

<SeekBar
     android:id="@+id/seekBar_fun"
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     android:layout_marginBottom="3dp"
     android:paddingLeft="10dp"
     android:paddingRight="10dp"
     android:max="100"
     android:progress="60"
     android:progressDrawable="@drawable/progressbar_goodbad"
     android:thumb="@drawable/f_02_good_bad_text" />

解决方法

@H_450_18@ (在Twinsens链接中找到答案.)

你的拇指图像需要在中心(水平)有黄点;向左或向右添加透明像素以使其成为可能.然后,将android:thumbOffset更改为拇指图像大小的一半.例如,如果您的图像宽度为10dp,请将android:thumbOffset设置为5dp.

大佬总结

以上是大佬教程为你收集整理的android – cant把拇指放在搜索栏的中心全部内容,希望文章能够帮你解决android – cant把拇指放在搜索栏的中心所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。