programmatically set margin/ padding of textview in a listview
maintitle.setPadding(50, 0, 0, 0);
(method 2) should work.
I think the problem is that, although you do a lot of changes to the TextView
, at the end you kind of inflate a new layout again in:
SimpleAdapter adapter = new SimpleAdapter(this, fillMaps, R.layout.main_alllatestnewslist, from, to);
so, make a custom adapter, then inflate and customize your TextView
in the getView()
.