簡體   English   中英

Android表格布局空單元格邊框和權重

[英]Android table layout empty cells border and weight

對於我的android應用程序,我需要創建由不同顏色的單元格(除以黑色邊框)組成的表格布局。 單元格應該為空,只能是背景色。 我按以下方式進行操作,但是沒有邊框出現,並且水平分割不正確。 看起來像3個相等的像元,而不是按照layout_weight 0.25 / 0.25 / 0.5。 有人可以建議嗎?

<TableLayout 
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="right"
    android:background="#000000">


    <TableRow
            android:id="@+id/tableRow5_11"
            android:layout_width="wrap_content"
            android:layout_height="80dp" 
            android:dividerPadding="5dp"
            android:background="#000000">

            <TextView
                    android:id="@+id/textView1"
                    android:layout_width="0dp"
                    android:layout_height="fill_parent"
                    android:background="#00FF00"
                    android:layout_weight="0.25"/>
            <TextView
                    android:id="@+id/textView2"
                    android:layout_width="0dp"
                    android:layout_height="fill_parent"
                    android:background="#00FF00"
                    android:layout_weight="0.25"
                    android:dividerPadding="5dp"
                    />
            <TextView
                    android:id="@+id/textView3"
                    android:layout_width="0dp"
                    android:layout_height="fill_parent"
                    android:background="#000000"
                    android:layout_weight="0.5"
                    android:layout_margin="2dp"/> 

    </TableRow>
</TableLayout>

更改此:

<TableRow
        android:id="@+id/tableRow5_11"
        android:layout_width="match_parent"

希望這可以幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM