that_person

Android Code Example: TextView (via http://goo.gl/oLJygl)

Aug 7th, 2014
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.51 KB | None | 0 0
  1. TextView textView = (TextView)row.findViewById(android.R.id.text1);
  2.     float scale = activity.getResources().getDisplayMetrics().density;
  3.     boolean leftPadding = (parent.getTag().equals("right"));
  4.     boolean topPadding = (position == 0);
  5.     textView.setPadding((int)(20 * scale) * (leftPadding ? 2 : 1), (int)(20 * scale) * (!leftPadding && topPadding ? 1 : 0), (int)(20 * scale), 0);
  6.     textView.setText(item);
  7.     textView.setTextColor(Color.BLACK);
  8.     textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);
Add Comment
Please, Sign In to add comment