The layout that I defined are as following
-----------------------------
button.xml-----------------------------------
<?xml version="1.0" encoding="utf-8"?>
<Button
xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/Theme.Button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
---------------------------------------------------------------------------------------------
----------------------------------main.xml----------------------------
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
xmlns:iii="http://schemas.android.com/apk/res/
org.iii.application.sis"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff"
>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal">
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:paddingLeft="20px"
android:id="@+id/left_cat"
/>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="right"
android:paddingRight="20px"
android:id="@+id/right_cat"
>
</LinearLayout>
</LinearLayout>
</ScrollView>
<com.ngu.android.view.BottomPanel
android:layout_weight="5"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</LinearLayout>
--------------------------------------------------------------------------------------------------------------------------------------
when I tried to add button dynamically in right_cat,
LayoutInflater layoutInflater = LayoutInflater.from(this);
LinearLayout rightLayout =
(LinearLayout)this.findViewById(R.id.right_cat);
Button button_BIO_Record_Table =
(Button)layoutInflater.inflate(R.layout.button, null);
button_BIO_Record_Table.setText(R.string.button_BIO_Record_Table);
rightLayout.addView(button_BIO_Record_Table);
android:layout_width and android:layout_height that I set on
button.xml did not have any effect(The button won't align to the right
of the screen).
However, when I added
button_BIO_Record_Table.setLayoutParams(new
LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
It works fine(The button would align to the right of the screen).
Did I mess up with anything?
Thank you very much for your kindly assistance and sorry for my poor
English.
Best Regards,
Ray
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en