开发者

Bottom button is cut off in my layout, we can't see the whole layout

开发者 https://www.devze.com 2023-04-04 23:42 出处:网络
I am using a relative layout to produce something that looks like image one. But on some phones (see image2) the bottom button is cut off and we can\'t see the whole layout. Isn\'t the purpose of rela

I am using a relative layout to produce something that looks like image one. But on some phones (see image 2) the bottom button is cut off and we can't see the whole layout. Isn't the purpose of relative layout to adjust itself depending on what phone it is?

What can I do to fix this? If there's no simple way should I just have it scroll down so that we can see the button?

Thanks

Bottom button is cut off in my layout, we can't see the whole layout

Bottom button is cut off in my layout, we can't see the whole layout

Here is my xml layout

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="fill_parent"
    android:background="@drawable/settings" android:layout_height="fill_parent"
    android:weightSum="1">
    <RelativeLayout android:layout_width="fill_parent" android:layout_height="45dp" android:background="@drawable/mytitlebackground">
        <Button android:layout_height="wrap_content" android:id="@+id/btnDeleteAccount" android:layout_width="wrap_content" android:text="@string/deleteacco开发者_高级运维unt" android:layout_alignParentTop="true" android:layout_alignParentLeft="true"></Button>
        <Button android:layout_height="wrap_content" android:id="@+id/btnhistory" android:layout_width="wrap_content" android:text="@string/history" android:layout_alignParentTop="true" android:layout_alignParentRight="true"></Button>
    </RelativeLayout>
    <RelativeLayout android:id="@+id/relativeLayout1" android:layout_width="262dp" android:layout_height="80dp" android:background="#333333" android:layout_below="@+id/textView1" android:layout_centerHorizontal="true" android:layout_marginTop="17dp">
        <TextView android:textStyle="bold" android:textColor="#ffffff" android:textSize="13sp" android:layout_marginTop="14dp" android:layout_marginLeft="14dp" android:text="@string/Name" android:layout_alignParentLeft="true" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignParentTop="true" android:id="@+id/textView2"></TextView>
        <TextView android:textStyle="bold" android:textSize="13sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#ffffff" android:id="@+id/textView3" android:text="@string/BackgroundUpdates" android:layout_below="@+id/textView2" android:layout_alignLeft="@+id/textView2" android:layout_marginTop="16dp"></TextView>
        <ToggleButton android:layout_width="wrap_content" android:id="@+id/toggleButtonBGUpdates" android:layout_height="wrap_content" android:layout_below="@+id/tVName" android:layout_toRightOf="@+id/textView3" android:layout_marginLeft="28dp"></ToggleButton>
        <TextView android:textSize="13sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#ffffff" android:id="@+id/tVName" android:text="name" android:layout_alignTop="@+id/textView2" android:layout_toRightOf="@+id/textView2" android:layout_marginLeft="19dp"></TextView>
    </RelativeLayout>
    <TextView android:text="@string/GPSInformation" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" android:layout_width="wrap_content" android:id="@+id/textView4" android:layout_below="@+id/relativeLayout1" android:layout_centerHorizontal="true" android:layout_marginTop="16dp"></TextView>
    <RelativeLayout android:id="@+id/relativeLayout2" android:layout_width="262dp" android:layout_height="130dp" android:background="#333333" android:layout_below="@+id/textView4" android:layout_alignLeft="@+id/relativeLayout1">
        <ImageView android:layout_marginLeft="18dp" android:layout_alignParentBottom="true" android:layout_width="wrap_content" android:layout_alignParentLeft="true" android:id="@+id/imageView1" android:layout_height="wrap_content" android:src="@drawable/fullbattery" android:layout_marginBottom="14dp"></ImageView>
        <ImageView android:layout_alignTop="@+id/imageView1" android:layout_alignParentRight="true" android:layout_width="wrap_content" android:layout_marginRight="18dp" android:id="@+id/imageView2" android:layout_height="wrap_content" android:src="@drawable/halfbattery"></ImageView>
        <RadioGroup android:layout_width="wrap_content" android:layout_alignParentTop="true" android:id="@+id/rGTimer" android:orientation="horizontal" android:layout_alignParentLeft="true" android:layout_height="wrap_content">
            <RadioButton android:layout_height="wrap_content" android:id="@+id/r30mins" android:text="@string/updateevery30mins" android:textSize="13sp" android:layout_width="130dp" android:checked="true"></RadioButton>
            <RadioButton android:layout_height="wrap_content"
    android:id="@+id/r10mins" android:text="@string/updateevery10mins"
    android:textSize="13sp" android:layout_width="130dp"></RadioButton>
        </RadioGroup>
    </RelativeLayout>
    <Button android:layout_height="wrap_content" android:id="@+id/btnRenableHelpScreen" android:layout_width="wrap_content" android:text="@string/Turnonhelpscreens" android:layout_below="@+id/relativeLayout2" android:layout_alignRight="@+id/textView4" android:layout_marginTop="14dp"></Button>
    <TextView android:text="@string/AccountInformation" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" android:layout_width="wrap_content" android:id="@+id/textView1" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="55dp"></TextView>

</RelativeLayout>


There are two ways.

  1. You should create image as per your layout in Android. Set them properly your re help screen button see proper and problem is solved but it sometimes create problem of blur of images and also you have to reduce the space between your components. And this is the best way, I used this way in many applications.

  2. Add scrollbar from starting of first layout.


Please check Font Size in Phone Settings under the Display Tab If it has been adjusted, then you have to use dp instead of sp to set Text View's textsize

This is working in my problem, should work on yours too.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号