簡體   English   中英

在我的布局中切斷了底部按鈕,我們無法看到整個布局

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

我使用相對布局來生成看起來像圖像的東西。 但在某些手機上(見圖2),底部按鈕被切斷,我們無法看到整個布局。 相對布局的目的不是根據手機來調整自己嗎?

我該怎么做才能解決這個問題? 如果沒有簡單的方法我應該向下滾動以便我們可以看到按鈕?

謝謝 在此輸入圖像描述

在此輸入圖像描述

這是我的xml布局

<?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/deleteaccount" 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>

有兩種方法。

  1. 您應該根據Android中的布局創建圖像。 正確設置它們的幫助屏幕按鈕看到正確並且問題已解決,但它有時會產生圖像模糊的問題,並且您還必須減少組件之間的空間。 這是最好的方法,我在許多應用程序中使用這種方式。

  2. 從第一個布局開始添加滾動條。

請檢查顯示選項卡下電話設置中的字體大小如果已調整,則必須使用dp而不是sp來設置文本視圖的文本大小

這是我的問題,也應該對你的問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM