首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >TableRow没有向右填充

TableRow没有向右填充
EN

Stack Overflow用户
提问于 2014-06-10 15:44:25
回答 1查看 111关注 0票数 0

我试着让这个TableRow一直到右边,但是没有任何运气。我相信我已经尝试过android的每一个组合:宽度。所以我要给专家们。下面是屏幕截图和xml :提示: CTRL+F表示“/”可以跳转到有问题的TableRow。

代码语言:javascript
复制
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/TableLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.hogarth45.smartestdiner.MainActivity$PlaceholderFragment"
    android:background="@drawable/sdback" >
<!--  
    <TableRow
        android:id="@+id/tableRow0"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" 
        android:gravity="center_horizontal">

        <TextView
            android:id="@+id/textView1"
            android:layout_width="0dip"
            android:layout_weight="1"
            android:layout_height="wrap_content"
            android:text="@string/SD"
            android:textColor="#CC4D22"
            android:textSize="30sp"
            android:textStyle="bold"
            />

    </TableRow>    
 -->   
    <TableRow
        android:id="@+id/tableRow1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <EditText
            android:id="@+id/ZIPeditText"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:ems="5"
            android:hint="@string/ZIP_txtview"
            android:inputType="number" >

            <requestFocus />
        </EditText>

        <Spinner
            android:id="@+id/Day_spinner"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:entries="@array/days_array" />

        <Spinner
            android:id="@+id/Choice_spinner"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:entries="@array/choice_array" />

        <Spinner
            android:id="@+id/Price_spinner"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:entries="@array/price_array" />

    </TableRow>

    <TableRow
        android:id="@+id/tableRow2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <Button
            android:id="@+id/Submit_butt"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="@string/Submit_butt_txt" />

    </TableRow>

    <TableRow
        android:id="@+id/tableRow3"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" 
        android:layout_weight="1">

        <ScrollView
            android:id="@+id/scrollView1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_span="4"
             >
            <!--   android:padding="5dp"-->


            <TableLayout
                android:id="@+id/scrollytable"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:stretchColumns="yes"
                 >
                 <!--   android:padding="5dp"-->

                <!--   ///////////////Here is the row that is being clipped//////android:stretchColumns="1,2,1,1"/////////////////////////////////////////////    -->   

                     <TableRow
                        android:id="@+id/StockTableScrollView"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:stretchColumns ="*"
                        android:background="@android:color/transparent"
                         >

                        <TextView
                            android:id="@+id/Dinner_name_textView"

                            android:layout_height="wrap_content"
                            android:text="@string/eman"
                            android:layout_column="0"
                            android:textIsSelectable="true"
                            android:layout_width="0dip" 
                            android:paddingRight="3dp"
                            android:layout_weight="1" />

                        <TextView
                            android:id="@+id/Special_txtview"

                            android:layout_height="wrap_content"
                            android:text="@string/ceps"
                            android:layout_column="1"
                            android:textIsSelectable="true"
                            android:layout_width="0dip" 
                            android:layout_weight="3"/>

                        <Button
                            android:id="@+id/moreInfoButt"
                            style="?android:attr/buttonStyleSmall"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_column="2"
                            android:text="@string/Butt_txt_Info" />

                        <Button
                            android:id="@+id/WebButton"
                            style="?android:attr/buttonStyleSmall"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_column="3"
                            android:text="@string/Butt_txt_Map" />

                    </TableRow>
      <!--   //////////////////////////////////////////////////////////////////      -->      

            </TableLayout>   
        </ScrollView>

    </TableRow>

    <TableRow
        android:id="@+id/tableRow4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <Button
            android:id="@+id/ClearButt"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="@string/Clear_butt_txt" />

    </TableRow>

</TableLayout>

解决了

将ScrollView更改为

代码语言:javascript
复制
<ScrollView
    android:id="@+id/scrollView1"
    android:layout_width="0dp"
    android:layout_weight="1"
    android:layout_height="wrap_content"
     >

EN

回答 1

Stack Overflow用户

发布于 2014-06-10 15:49:22

这是因为您的TableRow位于ScrollView中,它将与父级不匹配。

要实现这一点,您必须删除ScrollView

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24145310

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档