/ Published in: Java
This example adds a horizontally-centered TextView to the bottom of the RelativeLayout called 'layout'.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
TextView tv = new TextView(this); RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); tv.setLayoutParams( layoutParams ); tv.setText(getString(R.string.loading)); tv.setGravity(Gravity.CENTER_HORIZONTAL); layout.addView(tv);