gpt4 book ai didi

android - 在两个 TextView 之间定位搜索栏不起作用

转载 作者:行者123 更新时间:2023-11-29 15:20:02 24 4
gpt4 key购买 nike

我在两个 TextView 之间放置了一个搜索栏,但它没有按要求显示。下面是 XML

  <LinearLayout
android:id="@+id/timerDisplay"
android:layout_width="fill_parent"
android:layout_height="80dp"
android:orientation="horizontal" >

<!-- Current Duration Label -->
<TextView
android:id="@+id/songCurrentDurationLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:text="12.00"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:textColor="#eeeeee"
android:textStyle="bold"/>

<SeekBar
android:id="@+id/songProgressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:progressDrawable="@drawable/seekbar_progress"
android:thumb="@drawable/seek_handler" />

<!-- Total Duration Label -->
<TextView
android:id="@+id/songTotalDurationLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:text="10.00"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:textColor="#04cbde"
android:textStyle="bold"/>
</LinearLayout>

上面的结果类似于 enter image description here

然而这是想要的结果 enter image description here

我哪里错了?我不想硬编码 seekbar 的 layout_width,应该更改什么?

最佳答案

使用**android:weightSumandroid:layout_weight**

<LinearLayout
android:id="@+id/timerDisplay"
android:layout_width="fill_parent"
android:layout_height="80dp"
android:orientation="horizontal"
android:weightSum="100" >

<!-- Current Duration Label -->
<TextView
android:id="@+id/songCurrentDurationLabel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="left"
android:text="12.00"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:textColor="#eeeeee"
android:textStyle="bold"
android:layout_weight="10"/>

<SeekBar
android:id="@+id/songProgressBar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:progressDrawable="@drawable/seekbar_progress"
android:thumb="@drawable/seek_handler"
android:layout_weight="80" />

<!-- Total Duration Label -->
<TextView
android:id="@+id/songTotalDurationLabel"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="right"
android:text="10.00"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:textColor="#04cbde"
android:textStyle="bold"
android:layout_weight="10"/>
</LinearLayout>

关于android - 在两个 TextView 之间定位搜索栏不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19175350/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com