I'm creating one table layout with text view and spinner.
My textview content is too large, so it's wrapped up in my layout. Whenever the textview having wrapped, the same row spinner also increased the height.
My code is,
<TableRow
android:id="@+id/trConfigPeriodStop"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:weightSum="1" >
<TextView
android:id="@+id/tvConfigPeriodStop"
android:text="Periodic reporting interval while moving"
android:layout_weight="0.5"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:textColor="@color/gpsblue"
android:layout_marginLeft="5dp" />
<Spinner
android:id="@+id/spnConfigPeriodStop"
android:layout_weight="0.5"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:entries="@array/periodstop_arrays"
android:prompt="@string/periodstop_prompt"
/>
</TableRow>
Suppose I'm changing the layout height in wrap_content in spinner, that time my text view text also hide from view.
How to solve this issue? Please do the needful. Thanks in advance.
尝试将Spinner和TextView的布局高度都设置为wrap_content。
Try this :
<TableRow xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/trConfigPeriodStop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:textColor="@color/gpsblue"
android:weightSum="1" >
<TextView
android:id="@+id/tvConfigPeriodStop"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginLeft="5dp"
android:layout_weight="0.5"
android:text="Periodic reporting interval while moving" />
<Spinner
android:id="@+id/spnConfigPeriodStop"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="0.5"
android:entries="@array/periodstop_arrays"
android:prompt="@string/periodstop_prompt" />
</TableRow>
i guess it is because tablerow has android:layout_height="wrap_content" and inner textview has android:layout_height="fill_parent" , so the height of the tablerow will fit to the height of the spinner, that is the only child with fixed and independent height while rendering.
you will solve it if you change TextView's height also to android:layout_height="wrap_content"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.