SeekBar没有显示在视图xml文件上

时间:2014-10-24 15:20:07

标签: android

我试图让SeekBar显示在屏幕的底部,但实际上是在我创建的LinerLayout下,但我似乎无法显示它。我已将屏幕拆分为5个部分,并希望屏幕底部的搜索栏,我哪里出错了?

<LinearLayout 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"
android:background="@color/gray"
android:orientation="horizontal"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin" >

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

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1.0"
        android:orientation="vertical" >

        <FrameLayout
            android:id="@+id/white"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_margin="3dp"
            android:layout_weight="1.0"
            android:background="@color/white" />

        <FrameLayout
            android:id="@+id/green"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_margin="3dp"
            android:layout_weight="1.0"
            android:background="@color/green" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1.0"
        android:orientation="vertical" >

        <FrameLayout
            android:id="@+id/blue"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_margin="3dp"
            android:layout_weight="1.0"
            android:background="@color/blue" />

        <FrameLayout
            android:id="@+id/red"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_margin="3dp"
            android:layout_weight="1.0"
            android:background="@color/red" />

        <FrameLayout
            android:id="@+id/yellow"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_margin="3dp"
            android:layout_weight="1.0"
            android:background="@color/yellow" />
    </LinearLayout>

    <SeekBar
        android:id="@+id/seekBar1"
        android:layout_width="0dp"
        android:layout_height="wrap_content" />
</LinearLayout>

2 个答案:

答案 0 :(得分:1)

尝试将SeekBar layout_width更改为“match_parent”:

<SeekBar
    android:id="@+id/seekBar1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />

希望这有帮助。

答案 1 :(得分:0)

包含线性布局的方向=&#34;水平&#34;,尝试将其设置为&#34;垂直&#34;。