提示在真实设备上无法正常工作,但在仿真器上看起来很好

时间:2016-10-16 13:32:50

标签: android android-layout samsung-mobile

我在模拟器( Genymotion,Nexus 4,API 19 )上的InputLayout包含EditText包含的对话框布局一切看起来不错但在真实设备上(三星Galaxy J700H,API 23 )某些提示资源不适用。

fragment_add_polygon.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:padding="10dp"
    tools:context="com.mappolygon.PolygonDialogFragment">

    <android.support.v7.widget.GridLayout
        android:id="@+id/grid"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="10dp"
        app:columnCount="2">

        <android.support.design.widget.TextInputLayout
            android:id="@+id/layout_lat1"
            android:layout_width="0dp"
            app:layout_columnWeight="1">

            <EditText
                android:id="@+id/et_lat1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="@string/latitude_1"
                android:inputType="numberDecimal|numberSigned" />
        </android.support.design.widget.TextInputLayout>

        <android.support.design.widget.TextInputLayout
            android:id="@+id/layout_long1"
            android:layout_width="0dp"
            app:layout_columnWeight="1">

            <EditText
                android:id="@+id/et_long1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="@string/longitude_1"
                android:inputType="numberDecimal|numberSigned" />
        </android.support.design.widget.TextInputLayout>

        <android.support.design.widget.TextInputLayout
            android:id="@+id/layout_lat2"
            android:layout_width="0dp"
            app:layout_columnWeight="1">

            <EditText

                android:id="@+id/et_lat2"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="@string/latitude_2"
                android:inputType="numberDecimal|numberSigned" />
        </android.support.design.widget.TextInputLayout>

        <android.support.design.widget.TextInputLayout
            android:id="@+id/layout_long2"
            android:layout_width="0dp"
            app:layout_columnWeight="1">

            <EditText
                android:id="@+id/et_long2"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="@string/longitude_2"
                android:inputType="numberDecimal|numberSigned" />
        </android.support.design.widget.TextInputLayout>

        <android.support.design.widget.TextInputLayout
            android:id="@+id/layout_lat3"
            android:layout_width="0dp"
            app:layout_columnWeight="1">

            <EditText
                android:id="@+id/et_lat3"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="@string/latitude_3"
                android:inputType="numberDecimal|numberSigned" />
        </android.support.design.widget.TextInputLayout>

        <android.support.design.widget.TextInputLayout
            android:id="@+id/layout_long3"
            android:layout_width="0dp"
            app:layout_columnWeight="1">

            <EditText
                android:id="@+id/et_long3"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="@string/longitude_3"
                android:inputType="numberDecimal|numberSigned" />
        </android.support.design.widget.TextInputLayout>

        <android.support.design.widget.TextInputLayout
            android:id="@+id/layout_lat4"
            android:layout_width="0dp"
            app:layout_columnWeight="1">

            <EditText
                android:id="@+id/et_lat4"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="@string/latitude_4"
                android:inputType="numberDecimal|numberSigned" />
        </android.support.design.widget.TextInputLayout>

        <android.support.design.widget.TextInputLayout
            android:id="@+id/layout_long4"
            android:layout_width="0dp"
            app:layout_columnWeight="1">

            <EditText
                android:id="@+id/et_long4"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="@string/longitude_4"
                android:inputType="numberDecimal|numberSigned" />
        </android.support.design.widget.TextInputLayout>
    </android.support.v7.widget.GridLayout>

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab_add_coordinates"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:src="@drawable/ic_add"
        android:visibility="invisible"
        app:fabSize="mini" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:orientation="horizontal">

        <Button
            android:id="@+id/btn_build_polygon"
            style="@style/Base.Widget.AppCompat.Button.Colored"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
            android:text="@string/build_polygon" />

        <Button
            android:id="@+id/btn_cancel"
            style="@style/Base.Widget.AppCompat.Button.Colored"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/cancel" />
    </LinearLayout>
</LinearLayout>

模拟器的屏幕截图: [[1]]

来自真实设备的屏幕截图: [2]

这可能是什么原因? 的更新

对话框调用期间的日志。

I/MapsActivity: showDialog: showing polygon adding dialog
D/ViewRootImpl: #1 mView = com.android.internal.policy.PhoneWindow$DecorView{ddcd4d5 V.E...... R.....I. 0,0-0,0}
D/mali_winsys: new_window_surface returns 0x3000,  [312x920]-format:1
D/ViewRootImpl: MSG_RESIZED_REPORT: ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=1

0 个答案:

没有答案