【问题标题】:TableRow's column changes its sizeTableRow 的列改变了它的大小
【发布时间】:2017-12-14 08:01:38
【问题描述】:

我正在尝试为 Android 遥控器制作一个 XML 文件。我用过TableLayout

正如您从屏幕截图中看到的那样,列改变了它的大小(但所有图像的大小都相同)。问题只出在那一行。

这是我的代码的链接(不能放在这里,因为我的XML 太大了): https://codeshare.io/G6qDnk

【问题讨论】:

    标签: android tablelayout android-tablelayout tablerow


    【解决方案1】:
     <TableRow
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:gravity="center">
    
                <LinearLayout android:layout_height="wrap_content"
                    android:layout_width="match_parent"
                    android:orientation="vertical">
                    <View
                        android:layout_width="0dp"
                        android:layout_height="0dp"
                        android:layout_weight="0.5"/>
    
                    <ImageView
                        android:layout_width="wrap_content"
                        android:layout_height="0dp"
                        android:layout_weight="1"
                        android:layout_gravity="center"
                        app:srcCompat="@mipmap/right" />
                    <View
                        android:layout_width="0dp"
                        android:layout_height="0dp"
                        android:layout_weight="0.5"/>
                </LinearLayout>
    
            </TableRow>
    

    试试这个表格行代码,用于确定按钮周围的左按钮和右按钮。

    【讨论】:

    • Er.Tyson Subba,感谢您的回答。您会看到 LEFT 和 RIGHT 按钮现在变小了(它们的大小为 UP/DOWN 按钮),但目标是使它们与 FORWARD 按钮大小相同(现在它们更小了)
    • 没有改变:(
    • 它正在为我工​​作。你可能错过了代码中的某些内容。替换图像并检查。
    • 嗯,在我的情况下它不起作用,但是我会为你的回答点赞。感谢您的回答。
    猜你喜欢
    • 1970-01-01
    • 2012-09-27
    • 2016-05-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多