Android - Help needed in solving Layout inconsistancy (RelativeLayout and LinearLayout)?

The problem is that some of the child layout attributes for RelativeLayout such as layout_alignParentBottom="true require that the layout decide its own dimensions before laying out the child that wants to align to its Bottom. In effect, when the child asks to alignParentBottom, it forces the RelativeLayout to use all the vertical space available to it The last several items in your layout stack above the final element TextView android:id="@+id/textViewBottomMargin which is defined as alignParentBottom I fixed the layout by modifying those last few elements to align below the previous items instead of aligning above the last item LinearLayout xmlns:android="schemas.android.com/apk/res/android" android:id="@+id/statsTabLayout" android:scaleType="fitXY" android:background="#ffffff" android:layout_height="fill_parent" android:layout_width="fill_parent" android:baselineAligned="true" android:orientation="vertical.

The problem is that some of the child layout attributes for RelativeLayout, such as layout_alignParentBottom="true", require that the layout decide its own dimensions before laying out the child that wants to align to its Bottom. In effect, when the child asks to alignParentBottom, it forces the RelativeLayout to use all the vertical space available to it. The last several items in your layout stack above the final element, TextView android:id="@+id/textViewBottomMargin", which is defined as alignParentBottom.

I fixed the layout by modifying those last few elements to align below the previous items instead of aligning above the last item. I also modified the keyboard by removing its android:layout_alignParentBottom="true" statement. This is the screenshot op an HVGA_1.6 emulator (I made your keyboard area green for the screenshot).

As per the amended question, "also want the statsTopLayout to fill the screen when we don't include the keyboard" (see comments), I humbly submit these modifications to the original main and keyboard layout files: In the original main. Xml, change the root LinearLayout to a RelativeLayout, then move the to be its first element. In that moved element, add the android:id="@+id/numberPadLayoutContainer" statement from numerickeyboard.

Xml (and remove it from numerickeyboard. Xml (main. Xml won't compile without the local ID declaration).

The third element is now the enclosed RelativeLayout, which now specifies layout_height="fill_parent" and layout_above="@id/numberPadLayoutContainer". Screenshot with the statement: Screenshot without the statement and without the android:layout_above="@id/numberPadLayoutContainer" statement.

This is nice, but I am not sure it is the solution I am looking for. The relative layout containing the top controls was added to allow separation. The average/hi/lo/max on top, score/score cal in the middle and point entry at the bottom.

That would allow the app to re-size itself naturally when used on larger phones and tablets. The solution you suggest will cluster the controls at the top leaving a large blanks space on larger phones and tabs. – codingCat Aug 1 at 4:47 So, the question is again, how do I add the RelativeLayout at the top, and the keyboard (also a RelativeLayout) at the bottom, while allowing the controls to be placed as if it was the only layout on the screen?

– codingCat Aug 1 at 4:49 I edited the answer to provide a solution for your amended question. – cdhabecker Aug 1 at 5:34 That is it exactly. With this fix, adjusting the screen for different phones and tabs should only be a matter of setting the font size.

Thank you. I'm still not sure why your solution worked, but my original did not; nor am I sure why including the keyboard first should make a difference. But those are questions for another day... I hear my bed calling.

:-) – codingCat Aug 1 at 5:55 Oh, and thank you for the detailed answer, especially with the screen grabs. A lot of the time the answers are short, cryptic, and with partial or no examples. It was a great help for me, and I am sure it will help anyone stumbling across this question in the future.

Thanks again. – codingCat Aug 1 at 5:57.

It might be the case that when you put the keyboard layout at the bottom, it is being rendered off screen. You can easily see if that is the case by putting your entire layout into a ScrollView. I would also suggest you specify the layout_height of the keyboard using dp not pt values.

Otherwise, it might not look correct across various screen densities.

I agree, I'm fairly certain that the keyboard is being rendered off screen. The question is how do I get it to stop doing it. How do I get the statsTopLayout to play nice and share the physical screen with the keyboard.

– codingCat Aug 1 at 3:03 Oh, and the Pt value for the keyboard is irrelevant as it is re-sized dynamically when the app is run. This dynamic resizing is why it is important that the rest of the layout play nice and act as advertized. – codingCat Aug 1 at 3:04.

The problem is that some of the child layout attributes for RelativeLayout such as layout_alignParentBottom="true" require that the layout decide its own dimensions before laying out the child that wants to align to its Bottom. In effect, when the child asks to alignParentBottom, it forces the RelativeLayout to use all the vertical space available to it.

It might be the case that when you put the keyboard layout at the bottom, it is being rendered off screen. You can easily see if that is the case by putting your entire layout into a ScrollView.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions