If, for example, I defined a root linear layout whose orientation is vertical:
main.xml
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/my_root" android:layout_height="wrap_content" android:layout_width="fill_parent" android:orientation="vertical" <!-- I would like to add content here dynamically.--> </LinearLayout>
In the root linear layout, I would like to add several child linear layouts, each of which is oriented horizontally. With all this, I could get the table as an output.
For example, root with a child location, for example:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/my_root" android:layout_height="wrap_content" android:layout_width="fill_parent" android:orientation="vertical" <!-- 1st child (1st row)--> <LinearLayout ... android:orientation="horizontal"> <TextView .../> <TextView .../> <TextView .../> </LinearLayout> <!-- 2nd child (2nd row)--> ... </LinearLayout>
Since the number of child line layouts and their contents are quite dynamic, I decided to programmatically add content to the root linear layout.
How can I add a second layout to the first program, which can also set all the layout attributes for each child element and add other elements inside the child element?
android android-layout
Leem Jul 12 '11 at 8:15 2011-07-12 08:15
source share