Java – tablelayout – delete spaces between columns

I have a problem with tablelayout

First, take a look at the screenshot:

As you can see, there is a very large space in the middle of tablelayout I don't know how to reduce the middle space so that tablerows will have more width to cover Moreover, I want to reduce the space between tablerow and the space below it

I am programmatically adding views to tablelayout In addition, I have set the 'layout' of tablerow content_ Weight 'is set to 1F:

TableRow tr = (TableRow) new TableRow(mTableLayout.getContext());
TableRow.LayoutParams params = new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT,TableRow.LayoutParams.WRAP_CONTENT);
NormalCard card = new NormalCard();
card.setLayoutParams(new TableRow.LayoutParams(0,740,1f));
tr.addView(card);
mTableLayout.addView(tr,params);

XML declaration for tablelayout:

<TableLayout
            android:id="@+id/tableLayout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:shrinkColumns="*"
            android:stretchColumns="*"
            android:dividerPadding="0dp"
            android:showDividers="none"
            android:divider="@null">
        </TableLayout>

How to reduce the space in the middle of tablelayout Moreover, how to reduce the space between tablerow and the space below it

Thank you first

Solution

Use GridView layout This is enough for your view

http://www.javacodegeeks.com/2013/08/android-custom-grid-view-example-with-image-and-text.html

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>