开发者

Custom View and ViewGroup

i have create my own View and ViewGroup. The ViewGroup is a LinearLayout that includes a dynamic TableView. I add two rows, but only one is displayed. The first Row take the full height.

The Destination on Run is this Output:

Custom View and ViewGroup

But i need this:

Custom View and ViewGroup

Perfectly, the cells are square and the Bottom is unused. Like t开发者_如何学JAVAhis:

Custom View and ViewGroup

I have uploaded the stylized code

I hope someone can help me.

Sry, i cant include the images directly because: "We're sorry, but as a spam prevention mechanism, new users aren't allowed to post images. Earn more than 10 reputation to post images."

And the image Urls i have included as text because: "We're sorry, but as a spam prevention mechanism, new users can only post a maximum of two hyperlinks. Earn more than 10 reputation to post more hyperlinks."

Thank you


I dont know more about creating table by code but same problem i feel while creating the table from XMl file. In that time i have solved the problem by using height-width of linear layout with fill parent option. Or U can Use Relative Layout instead of the Linear Layout and try it. May be it helps u.


Try setting the weights this way.

float rowWeight = 1/noOfColumns;
TableRow.LayoutParams mCellLayoutParams = new TableRow.LayoutParams(TableRow.LayoutParams.FILL_PARENT, TableRow.LayoutParams.FILL_PARENT, rowWeight );
mCellLayoutParams.setMargins(5, 5, 5, 5);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜