How can I add separating lines between my TableRows that are created programmatically?

后端 未结 3 2187
感情败类
感情败类 2020-12-15 06:18

I have a TableLayout that is created programmatically in an Android project. I keep adding TableRows as long as there are more rows fetched from the database. Now I want to

3条回答
  •  粉色の甜心
    2020-12-15 06:45

    View v = new View(this);
    v.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.FILL_PARENT, 1));
    v.setBackgroundColor(Color.rgb(51, 51, 51));
    tr.addView(mTvDate);
    tr.addView(mTvResult);
    
    tl.addView(tr); 
    tl.addView(v);
    

    Here I'm creating a view that is one pixel high with a specific background color. This works for me.

提交回复
热议问题