有人知道如何通过代码设置SeekBar
的最小和最大高度吗?我想重现与以下 XML 摘录相同的行为:
<SeekBar android:minHeight="6dip"
android:maxHeight="6dip" ... />
最佳答案
不知道有没有代码。我实现了这个创建一个具有最大高度和其他属性的 xml,并在其定义中膨胀 seekBar:
在 XML 中:
<?xml version="1.0" encoding="utf-8"?>
<SeekBar xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:progressDrawable="@drawable/custom_player_seekbar_background"
android:paddingTop="10px"
android:paddingBottom="10px"
android:thumb="@drawable/bt_do_player"
android:paddingLeft="30px"
android:paddingRight="30px"
android:minHeight="6dip"
android:maxHeight="6dip"
android:layout_height="wrap_content"
android:layout_centerVertical="true"/>
在java代码中:
volumeSeekBarPL = (SeekBar) getLayoutInflater().inflate(R.layout.custom_seek_bar, null);
关于android - SeekBar minHeight 和 maxHeight 通过代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7518154/