【问题标题】:Seek bar position scale error寻条位置刻度误差
【发布时间】:2013-09-17 16:11:29
【问题描述】:

我设置了一个搜索栏并使用左侧和顶部边距设置位置。我需要seekvar是垂直的,所以我旋转了270。我想将seekbar定位在旋转位置一直到视图的右侧,但是seekbar的行程越接近终点越小并覆盖android :布局宽度。 V安卓4.0.3

    <SeekBar
    android:id="@+id/seekBarDimmer"
    android:layout_marginLeft="880dp"
    android:layout_marginTop="330dp"
    android:layout_width="270dp"
    android:layout_height="wrap_content" 
    android:background="@color/slider"
    android:thumb="@drawable/sliderred"
    android:rotation="270"/>

【问题讨论】:

    标签: android xml seekbar


    【解决方案1】:

    为什么要使用 marginLeft 和 marginTop 来设置位置。我认为您应该更好地使用相对布局并使用属性 android:layout_alignParentRight="true" 您可以使搜索栏一直到视图的右侧。还使用(负值)android:layout_marginRight 小于搜索栏宽度大小的一半,使其位于右侧。

    我认为你看起来像这样..

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >
    
    <SeekBar
    android:id="@+id/seekBarDimmer"
    android:layout_width="270dp"
    android:layout_height="wrap_content" 
    android:layout_alignParentRight="true"
    android:layout_centerVertical="true"
    android:layout_marginRight="-120dp"
    android:layout_marginTop="10dp"
    android:rotation="270"/>
    
    </RelativeLayout>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-02
      • 2016-07-26
      • 1970-01-01
      • 2012-03-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多