Android的TextView设置padding无效

I finally found the problem I have to set the background first before setting the padding. Setting the padding then setting the background doesn't work

// does not work
tv.setPadding(20, 20, 20, 20);
tv.setBackgroundResource(R.drawable.border);


// works
tv.setBackgroundResource(R.drawable.border);
tv.setPadding(20, 20, 20, 20);

 

原文地址:https://stackoverflow.com/questions/18327498/setting-padding-for-textview-not-working

 

 

posted on 2018-04-19 11:21  albert1017  阅读(4748)  评论(0编辑  收藏  举报

导航