开发者

align listview to the center

开发者 https://www.devze.com 2023-04-02 07:20 出处:网络
I have an android application that uses a custom listview. All I want to do is to make this listview aligning center and not filling all the window (horizontal). for tha开发者_如何学运维t purpose I se

I have an android application that uses a custom listview. All I want to do is to make this listview aligning center and not filling all the window (horizontal). for tha开发者_如何学运维t purpose I set padding

 list.setPadding(20, 0, 20, 0);
    list.setBackgroundColor(Color.RED);

I want to set up a background color for space that listview in and another background for the padding space. when I write the above code only on click the main content background returning to black. How do I accomplish that? Thanks


Please check if using margins solves your problem.

0

精彩评论

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