Friday, September 3, 2010

[android-developers] Layout question.

posted Yesterday 10:29:31 PM private message
Quote
This isn't so much Java, but it sure is an Android question.

I'm having trouble adding some buttons underneath a scroll view.

What I want is a tab pane, with a header row, then a scroll view of a
table containing a variable number of rows, then two buttons side by
side.

What I have is this:


1. <?xml version="1.0" encoding="utf-8"?>
2. <LinearLayout
3. xmlns:android="http://schemas.android.com/apk/res/android"
4. android:orientation="vertical"
5. android:layout_width="fill_parent"
6. android:layout_height="fill_parent">
7. <RelativeLayout
8. android:id="@+id/RelativeLayout01"
9. android:layout_width="wrap_content"
10. android:layout_height="wrap_content">
11. <ImageView
12. xmlns:android="http://schemas.android.com/apk/res/
android"
13. android:id="@+id/ImageView_Header"
14. android:layout_width="wrap_content"
15. android:layout_height="wrap_content"
16. android:src="@drawable/replayaicon"
17. android:layout_alignParentLeft="true"
18. android:layout_alignParentTop="true"></ImageView>
19. <TextView
20. android:id="@+id/TextView01"
21. android:layout_height="wrap_content"
22. android:text="@string/create_groups"
23. android:textSize="@dimen/screen_title_size"
24. android:shadowDx="0"
25. android:shadowDy="0"
26. android:shadowRadius="10"
27. android:layout_width="wrap_content"
28. android:layout_gravity="fill_horizontal|center"
29. android:layout_alignParentTop="true"
30. android:layout_centerHorizontal="true"
31. android:shadowColor="@android:color/white"
32. android:textColor="@color/title_color"></TextView>
33. <ImageView
34. xmlns:android="http://schemas.android.com/apk/res/
android"
35. android:id="@+id/ImageView_Header2"
36. android:layout_height="wrap_content"
37. android:src="@drawable/replayaicon"
38. android:layout_gravity="right|center_vertical"
39. android:layout_width="wrap_content"
40. android:layout_alignParentRight="true"
41. android:layout_alignParentTop="true"></ImageView>
42. </RelativeLayout>
43. <TabHost
44. android:id="@+id/TabHost1"
45. android:layout_width="fill_parent"
46. android:layout_height="fill_parent">
47. <LinearLayout
48. android:orientation="vertical"
49. android:layout_width="fill_parent"
50. android:layout_height="fill_parent">
51. <TabWidget
52. android:id="@android:id/tabs"
53. android:layout_width="fill_parent"
54. android:layout_height="wrap_content" />
55. <FrameLayout
56. android:id="@android:id/tabcontent"
57. android:layout_width="fill_parent"
58. android:layout_height="fill_parent">
59. <ScrollView
60. android:id="@+id/ScrollViewAddGroups"
61. android:layout_width="fill_parent"
62. android:layout_height="fill_parent"
63. android:scrollbars="vertical">
64. <TableLayout
65. android:id="@+id/
TableLayout_AddGroups"
66. android:layout_width="fill_parent"
67. android:layout_height="fill_parent"
68. android:stretchColumns="*">
69. </TableLayout>
70. </ScrollView>
71.
72.
73.
74. <!-- THESE ARE THE TWO BUTTONS I WANT AT THE BOTTOM OF THE FIRST
TAB -->
75. <Button android:id="@+id/ok_button"
76. android:layout_width="wrap_content"
77. android:layout_height="wrap_content"
78. android:text="@string/ok">
79. </Button>
80.
81. <Button android:id="@+id/cancel_button"
82. android:layout_width="wrap_content"
83. android:layout_height="wrap_content"
84. android:text="@string/cancel">
85. </Button>
86.
87.
88.
89. <ScrollView
90. android:id="@+id/ScrollViewModifyGroups"
91. android:layout_width="fill_parent"
92. android:layout_height="fill_parent"
93. android:scrollbars="vertical">
94. <TableLayout
95. android:id="@+id/
TableLayout_ModifyGroups"
96. android:layout_width="fill_parent"
97. android:layout_height="fill_parent"
98. android:stretchColumns="*"></
TableLayout>
99. </ScrollView>
100. </FrameLayout>
101. </LinearLayout>
102. </TabHost>
103. </LinearLayout>


What do I need to do to get the buttons at the bottom of tab1 just
below the scroll view? Everything looks just great except for the
buttons. Right now they overlap one another and are on top of the
scroll view. If I remove the buttons all is perfect.

I've tried to add various layouts surrounding the buttons but this
always seemed to cause my application to crash.

THANKS!

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment