[英]Right Drawer Layout out of margin
我在我的應用程序中使用DrawerLayout。 我在三星note 3和三星S4中進行了測試,一切都很好。 但是,當它對三星S3進行測試時,布局混亂了。 請參考下圖
在Samsung Note 3和Samsung S4中進行測試: http : //www.imagesup.net/? di= 1514046988962
在Samsung S3中測試: http : //www.imagesup.net/? di= 14140469921515
我的xml布局代碼如下:
<include
android:id="@+id/shopping_cart_slider"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="end"
layout="@layout/shopping_cart_redesign"
android:choiceMode="singleChoice" />
這是包含的布局:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/grey_register_text" >
<LinearLayout
android:id="@+id/shopping_cart_redesign_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/grey_register_text"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<RelativeLayout
android:id="@+id/info_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:orientation="vertical" >
<ImageView
android:id="@+id/logo_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:contentDescription="@string/desc_list_item_icon" />
<com.zukami.apps.dev.blynk.util.CustomListView
android:id="@+id/list_shopping_cart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/logo_image"
android:background="@android:color/white"
android:divider="@color/grey_register_text"
android:dividerHeight="1dp" >
</com.zukami.apps.dev.blynk.util.CustomListView>
<View
android:id="@+id/border"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@+id/list_shopping_cart"
android:layout_marginTop="5dp"
android:background="@color/grey_register_text" />
<RelativeLayout
android:id="@+id/total_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/border"
android:layout_marginTop="10dp" >
<LinearLayout
android:id="@+id/total_text_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="2dp"
android:orientation="vertical" >
<TextView
android:id="@+id/total_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="@string/total"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="@+id/merchandise_total"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="@string/merchandise_total"
android:textSize="15sp" />
<TextView
android:id="@+id/loyalty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="@string/loyalty"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:orientation="vertical" >
<TextView
android:id="@+id/total_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="@+id/total_points"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:textSize="15sp" />
</LinearLayout>
</RelativeLayout>
<View
android:id="@+id/border_two"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@+id/total_layout"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:background="@android:color/black" />
<Button
android:id="@+id/confirm_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/border_two"
android:layout_marginBottom="2dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="10dp"
android:background="@drawable/grey_shopping_cart_button"
android:gravity="center|center_horizontal"
android:text="@string/confirm_order"
android:textColor="@android:color/white"
android:textSize="16sp"
android:textStyle="bold" />
<View
android:id="@+id/space"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_below="@+id/confirm_button"
android:layout_marginTop="5dp" />
</RelativeLayout>
<ImageView
android:id="@+id/receipt_border"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/info_container"
android:layout_marginTop="-6dp"
android:contentDescription="@string/icon"
android:src="@drawable/receipt_border" />
<TextView
android:id="@+id/receipt_footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/receipt_border"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textColor="@android:color/white"
android:textSize="15sp" />
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleLargeInverse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:visibility="gone" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
請告知此布局有什么問題,因為我已將所有寬度設置為與父級匹配,但仍不能在所有設備上使用。 非常感謝您的任何幫助。
嗯,我現在看不到任何錯誤。
有一次我遇到一個問題,我的代碼上的所有內容都不對,但是在運行API 18+的設備上, android:gravity="center_vertical"
簡單的代碼無法正常工作,但我修復了它,只是更改了android:target="18"
到android:target="16"
。 我選擇“ 16”是因為它運行的是我的Android版本,沒有任何問題。
我不知道這是否是您的情況,但是請更改Android Manifest.xml中的android target屬性,只需嘗試一下(y)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.