SeekBar minHeight和maxHeight的代码
问题描述:
有谁知道如何通过代码设置最小和最大SeekBar
的高度?我想重现与以下XML摘录相同的行为:SeekBar minHeight和maxHeight的代码
<SeekBar android:minHeight="6dip"
android:maxHeight="6dip" ... />
答
我不知道是否有代码。我做到这一点创建具有最大高度和其他属性的XML,并在其定义充气搜索条:
在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);
它的工作完美!非常感谢! – Alesqui