[Android] Dynamically Set Layout Elements

  • 0
Can I set “android:layout_below” at runtime, programmatically?
RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
        ViewGroup.LayoutParams.WRAP_CONTENT);

p.addRule(RelativeLayout.BELOW, R.id.below_id);

viewToLayout.setLayoutParams(p);

Dynamically Set TextView Size
text.setTextSize(TypedValue.COMPLEX_UNIT_SP,14);

沒有留言 :

張貼留言