Android 微调器下拉箭头图标在UI内部不可见

Android 微调器下拉箭头图标在UI内部不可见,android,android-layout,android-spinner,android-tablelayout,android-relativelayout,Android,Android Layout,Android Spinner,Android Tablelayout,Android Relativelayout,我在TableLayout的TableRow中放置了一个微调器。微调器下拉图标不可见 表1: 我将微调器放置在表行内,但我的微调器下拉箭头在表行内不可见 表2: 我已将微调器放置在表行内的相对布局中,在这种情况下,微调器下拉列表不可见,UI屏幕中的微调器宽度超过相对布局 如何将微调器固定到显示下拉图标的宽度?下面的代码有什么问题 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://

我在TableLayout的TableRow中放置了一个微调器。微调器下拉图标不可见

表1: 我将微调器放置在表行内,但我的微调器下拉箭头在表行内不可见

表2: 我已将微调器放置在表行内的相对布局中,在这种情况下,微调器下拉列表不可见,UI屏幕中的微调器宽度超过相对布局

如何将微调器固定到显示下拉图标的宽度?下面的代码有什么问题

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">
    <TableLayout
        android:layout_height="wrap_content"
        android:layout_width="match_parent">
        <TableRow style="@style/HeaderRow"
            android:weightSum="10">
            <ImageView
                android:layout_width="0dp"
                android:layout_weight="1"
                android:src="@drawable/ic_info_white"
                style="@style/HeaderText" />
            <RelativeLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="5" >
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"
                    android:text="Information"
                    android:paddingLeft="@dimen/ten"
                    android:textColor="@color/color_white"/>
            </RelativeLayout>
            <ImageView
                android:layout_width="0dp"
                style="@style/HeaderText"
                android:src="@drawable/ic_info_white"
                android:layout_weight="1" />
            <Spinner
                android:layout_width="0dp"
                android:layout_weight="4"
                android:layout_height="match_parent" />
        </TableRow>
    </TableLayout>
    <TableLayout
        android:layout_height="wrap_content"
        android:layout_width="match_parent">
        <TableRow style="@style/HeaderRow"
            android:weightSum="10">
            <ImageView
                android:layout_width="0dp"
                android:layout_weight="1"
                android:src="@drawable/ic_info_white"
                style="@style/HeaderText" />
            <RelativeLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="5" >
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"
                    android:text="Information"
                    android:paddingLeft="@dimen/ten"
                    android:textColor="@color/color_white"/>
            </RelativeLayout>
            <ImageView
                android:layout_width="0dp"
                style="@style/HeaderText"
                android:src="@drawable/ic_info_white"
                android:layout_weight="1" />
            <RelativeLayout
                android:layout_width="0dp"
                android:layout_weight="4"
                android:layout_height="match_parent" >
                <Spinner
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"/>
            </RelativeLayout>
        </TableRow>
    </TableLayout>
</LinearLayout>

Style.xml

<style name="HeaderRow">
    <item name="android:background">#A3A3A3</item>
    <item name="android:layout_width">match_parent</item>
    <item name="android:layout_height">match_parent</item>
</style>
<style name="HeaderText">
    <item name="android:textColor">@color/color_white</item>
    <item name="android:shadowColor">#AFFFFFFF</item>
    <item name="android:shadowDx">1</item>
    <item name="android:shadowDy">1</item>
    <item name="android:shadowRadius">1.0</item>
    <item name="android:padding">5dp</item>
    <item name="android:gravity">center</item>
    <item name="android:textSize">14sp</item>
    <item name="android:textStyle">bold</item>
    <item name="android:background">@drawable/border</item>
    <item name="android:layout_width">wrap_content</item>
    <item name="android:layout_height">match_parent</item>
</style>

#A3A3
匹配父项
匹配父项
@颜色/颜色/白色
#AFFFFFF
1.
1.
1
5dp
居中
14便士
大胆的
@可提取/边界
包装内容
匹配父项

您可以试试这个:

 <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:orientation="vertical">

 <TableLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content">


    <TableRow>

        <LinearLayout
            android:layout_weight="1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <ImageView
                android:layout_width="wrap_content"
                android:layout_weight="1"
                android:src="@drawable/ic_info_white"
                android:layout_height="wrap_content" />

            <RelativeLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="5">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"
                    android:paddingLeft="10dp"
                    android:text="Information"
                    android:textColor="@color/colorBlack" />
            </RelativeLayout>
        </LinearLayout>

        <LinearLayout
            android:layout_weight="1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <ImageView
                android:layout_width="wrap_content"
                android:layout_weight="1"
                android:src="@drawable/ic_info_white"
                android:layout_height="wrap_content" />

            <RelativeLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="5">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"
                    android:paddingLeft="10dp"
                    android:text="Information"
                    android:textColor="@color/colorBlack" />
            </RelativeLayout>
        </LinearLayout>
    </TableRow>
    <TableRow>
        <LinearLayout
            android:layout_weight="1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <ImageView
                android:layout_width="wrap_content"
                android:layout_weight="1"
                android:src="@drawable/ic_info_white"
                android:layout_height="wrap_content" />

            <RelativeLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="5">

                <Spinner
                    android:layout_width="0dp"
                    android:layout_weight="4"
                    android:layout_height="match_parent" />

            </RelativeLayout>
        </LinearLayout>

        <LinearLayout
            android:layout_weight="1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <ImageView
                android:layout_width="wrap_content"
                android:layout_weight="1"
                android:src="@drawable/ic_info_white"
                android:layout_height="wrap_content" />

            <RelativeLayout
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight="5">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"
                    android:paddingLeft="10dp"
                    android:text="Information"
                    android:textColor="@color/colorBlack" />
            </RelativeLayout>
        </LinearLayout>
    </TableRow>

 </TableLayout>


</LinearLayout>


希望这对您有所帮助…如果您需要任何帮助,您可以请求,因为您已将
TableRow
weightsum
值添加为10,那么所有子视图
layou weight
值总和也应为10

比如,

 <TableRow
        style="@style/HeaderRow"
        android:weightSum="10">

        <ImageView
            style="@style/HeaderText"
            android:layout_width="0dp"
            android:layout_weight="1" />

        <RelativeLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="4">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:paddingLeft="10dp"
                android:text="Information"
                android:textColor="#FFFFFF" />
        </RelativeLayout>

        <ImageView
            style="@style/HeaderText"
            android:layout_width="0dp"
            android:layout_weight="1" />

        <Spinner
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="4" />
    </TableRow>


答案中的微调器在哪里?@appukrb检查一下