Android SeekBar Length Doesn't match layout_width value

I am trying to make an anchor width search bar in my layout, however, once the finder barcode width exceeds a certain value, the search width will not reflect the value I set. For example:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <SeekBar
        android:rotation="270"
        android:id="@+id/volumeBar"
        android:layout_width="50dp"
        android:layout_margin="1px"
        android:layout_height="wrap_content"
        android:layout_centerInParent = "true"/>
</RelativeLayout>

      

creates a short search bar as it should, as the width dictates that it should only be 50dp. Here's the layout: enter image description here

Now when I change the layout_width to 300dp I see a cropped breaker, which is of course not 300dp. Heres file and layout:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <SeekBar
        android:rotation="270"
        android:id="@+id/volumeBar"
        android:layout_width="300dp"
        android:layout_margin="1px"
        android:layout_height="wrap_content"
        android:layout_centerInParent = "true"/>
</RelativeLayout>

      

enter image description here

Note. ... It looks like the width pointer is limited to the width of the relative layout (red rectangle) and anytime the arrow length (given by android: layout_width) exceeds the width of RelativeLayout the length of that length is limited. How can I make my search bar obey my desired hardcoded length?

Edit: I've included the parent activity xml file below.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" 
    android:orientation="horizontal"
    android:baselineAligned="false"
    android:keepScreenOn="true">

    <LinearLayout    
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight="1.25"
        android:background="#ffdd4c4f"
        android:orientation="vertical" 
        android:id="@+id/toolbarGestureOverlay" >
        <android.support.v4.view.ViewPager
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/pager"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
        </android.support.v4.view.ViewPager>
    </LinearLayout>  

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:orientation="vertical" 
        android:layout_weight="3.75">
    <com.example.project.Multitouch
        android:id="@+id/fretBoard"  
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:background="#3EF20C"/>
    </LinearLayout>    
</LinearLayout>

      

+3


source to share


1 answer


You can try with



   <SeekBar
        android:rotation="270"
        android:id="@+id/volumeBar"
        android:layout_width="match_parent"
        android:layout_margin="10dp"
        android:layout_height="wrap_content"
        android:layout_centerInParent = "true"/>

      

0


source







All Articles