Programmatically set border for TableRow array

╄→尐↘猪︶ㄣ 提交于 2019-12-04 14:51:19

But how to add borders in every row (prefer horizontal and vertical)? I hoped this was the solution:

If you just want to have borders around your TableRows you can simply use the drawable below as the background for the TableRow:

R.drawable.row_border :

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >

    <solid android:color="#ffffff" />
    <stroke android:width="3dp" android:color="#99cc00" />

</shape>

then:

tbrow.setBackgroundResource(R.drawable.row_borders);

If you want to obtain a constant width border, you can use instead a layer-list with three versions, one for the top row, one for the rows in the middle and one for the bottom row.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!