Yon*_*Nir 1 android android-layout android-layout-weight
我得到了这个布局:
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="6sp"
android:layout_marginLeft="16sp"
android:layout_marginRight="6sp"
android:layout_marginTop="6sp" >
<TextView android:id="@+android:id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceListItem"
android:inputType="none" />
<TextView android:id="@+android:id/summary"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_below="@android:id/title"
android:maxLines="2"
android:layout_width="wrap_content" />
</RelativeLayout>
<!-- Preference should place its actual preference widget here. -->
<!-- android:id="@android:id/widget_frame" -->
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginBottom="6sp"
android:layout_marginLeft="6sp"
android:layout_marginRight="6sp"
android:layout_marginTop="10sp"
android:gravity="center_vertical"
android:orientation="horizontal"
android:weightSum="1" >
<SeekBar
android:id="@+id/change_seekbar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:paddingLeft="20dip"
android:paddingRight="20dip" >
</SeekBar>
<TextView
android:id="@+id/Text_Box_seek"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dip"
android:textSize="16dip" >
</TextView>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
我希望搜索栏占据内部线性布局中宽度的 80%,但搜索栏仍然很小..为什么它不占据其余空间?
将布局宽度更改LinearLayout
为 match_parent 或为其设置特定值。
说明
如果您使用 LinearLayout width =wrapp_content,LinearLayout 的宽度将取决于子级。
并且您还设置了子级的权重,因此子级的宽度将取决于父级。
=>(父级的宽度取决于子级,子级的宽度取决于父级)那么我认为视图将不知道该怎么做
归档时间: |
|
查看次数: |
1356 次 |
最近记录: |