Bincy Baby Bincy Baby - 6 months ago 183
Android Question

AppCompatSeekBar left and right padding removal?

refer image

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<com.SocialMob.CustomViews.CustomTextView
android:id="@+id/textViewCurrentDurationMusic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/_3sdp"
android:singleLine="true"
android:text="01:00"
android:textColor="#AEAEAE"/>

<android.support.v7.widget.AppCompatSeekBar
android:id="@+id/seekBarMusic"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:max="100"
android:paddingLeft="0px"
android:thumbOffset="-1px"
android:paddingRight="0px"
android:progress="60"
android:layout_margin="0dp"
app:theme="@style/SeekBarTheme"
app:paddingEnd="0px"
app:paddingStart="0px" />

<com.SocialMob.CustomViews.CustomTextView
android:id="@+id/textViewTotalDurationMusic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end"
android:padding="@dimen/_3sdp"
android:text="05:00"
android:textColor="#AEAEAE"/>
</LinearLayout>


Am doing an music player app which has SeekBar, I want to remove extra padding in both ends of SeekBar. I have tried 0 padding, 0 margin, -ve padding and -ve margin.

Answer

Why not try modify it by java code.try the following sample code.

 seekBar.setPadding(0, 0, 0, 0);

This may helps you.