HI, i want to put a textview at the bottom of my screen, if i implement the code with layout.xml it is working fine.
But if i want to implement the same code with activity.java it is not coming at the bottom. here are my layout.xml and my activity.java files, please help and let me know where could i done mistake ?
my Activity code :
But if i want to implement the same code with activity.java it is not coming at the bottom. here are my layout.xml and my activity.java files, please help and let me know where could i done mistake ?
Code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:layout_width="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent" android:paddingTop="10dp">
<LinearLayout android:orientation="horizontal"
android:id="@+id/footer_linear_view" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_alignParentBottom="true">
<TextView android:text="Hello Namasthe" android:layout_width="fill_parent" android:layout_height="fill_parent"/>
</LinearLayout>
</RelativeLayout>
my Activity code :
Code:
rLayout = new RelativeLayout(this);
lLayout = new LinearLayout(this);
texView = new TextView(this);
rLayout.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
android.widget.RelativeLayout.LayoutParams tParams = new android.widget.RelativeLayout.LayoutParams(android.widget.RelativeLayout.LayoutParams.FILL_PARENT,android.widget.RelativeLayout.LayoutParams.WRAP_CONTENT);
tParams.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);
lLayout.setLayoutParams(tParams);
texView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
texView.setText("Subhodayam");
lLayout.addView(texView);
rLayout.addView(lLayout);
setContentView(rLayout);