简体   繁体   English

SeekBar 指针不在中心 Android Studio Java

[英]SeekBar pointer not in the centre Android Studio Java

I am making a SeekBar in my Android Java application for the first time, but the slider circle is not in the middle of the line as I would expect, but a little above it.我是第一次在我的 Android Java 应用程序中创建一个 SeekBar,但是滑块圆圈并不像我期望的那样位于线的中间,而是在它上面一点。 I can't figure out why this is the case.我不明白为什么会这样。

There is an image of the slider at http://i.stack.imgur.com/AAGkM.jpg http://i.stack.imgur.com/AAGkM.jpg上有滑块的图像

My layout for the slider is:我的滑块布局是:

    <SeekBar
    android:layout_width="match_parent"
    android:id="@+id/seekBar"
    android:layout_height="0dp"
    android:layout_weight="0.5"
    android:background="#ffff4007"
    android:progress="0"
    android:max="100"/>

您可以发布您的布局代码以更好地帮助您,也许您可​​以试试这个

android:gravity="center"

要做到这一点,请使用 android:progress=0 在 java 中使用 Seekbar.setmax(to set maxm value..as integer);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM