通过代码SeekBar minHeight和maxHeight

Ale*_*qui 4 android seekbar

有人知道如何SeekBar通过代码设置最小和最大高度吗?我想重现与以下XML摘录相同的行为:

<SeekBar android:minHeight="6dip"
         android:maxHeight="6dip" ... />
Run Code Online (Sandbox Code Playgroud)

flo*_*pes 5

I do not know if there is a code for it. I achieve this creating an xml with the maximum height and other attributes and inflating the seekBar in its definition:

In 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"/>
Run Code Online (Sandbox Code Playgroud)

And in the java code:

volumeSeekBarPL = (SeekBar) getLayoutInflater().inflate(R.layout.custom_seek_bar, null);
Run Code Online (Sandbox Code Playgroud)