Positioning A View With Top Expressed As A Percentage Of Display Height
I just know this is simple and in about 30 minutes time, I'll hate myself... I have a splashscreen which consists of a static image which fills the screen. So I simply set the bac
Solution 1:
You say you can't use layout_weight
, but that's your only option if you want to do it purely in XML. I don't understand why you think you can't use it anyway. Here's an example of how you might do it:
<LinearLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"android:background="@drawable/splash"android:orientation="vertical" ><Viewandroid:layout_width="match_parent"android:layout_height="0dp"android:layout_weight="58" /><LinearLayoutandroid:layout_width="match_parent"android:layout_height="0dp"android:layout_weight="42" ><!-- Place buttons here --></LinearLayout></LinearLayout>
Solution 2:
I don't see any other way that to use a layout_weight... Also the whole class AbsoluteLayout
is deprecated, so try to avoid using it. I suggest to use an LinearLayout
as your rootView with a given weight_sum of 1. add another Space-filling LinearLayout width a weight of 0.58 and below your Button with wrap_content attributes. Unfortunately I cannot tell you more unless you post your xml, so that I can see, what you try to achieve.
Kind of this should work:
<LinearLayoutandroid:layout_width="fill_parent"android:layout_height="fill_parent"android:background="@drawable/your_desired_background"android:orientation="vertical"android:weight_sum="1"><LinearLayoutandroid:layout_width="fill_parent"android:layout_height="0dp"android:layout_weight=".58" /><Buttonandroid:layout_width="fill_parent"android:layout_height="wrap_content" /></LinearLayout>
Post a Comment for "Positioning A View With Top Expressed As A Percentage Of Display Height"