画得错误

时间:2017-01-11 10:30:06

标签: android

我有一个视频录制应用程序,其中我覆盖了“开始录制”/“停止录制”按钮,如下所示:

enter image description here

enter image description here

我使用以下drawables创建这些:

界:

 <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape xmlns:android="http://schemas.android.com/apk/res/android"
               android:shape="oval">

            <stroke
                android:width="3dp"
                android:color="@android:color/white"/>
            <solid android:color="@android:color/transparent" />

            <padding android:bottom="10dp"
                     android:top="10dp"
                     android:right="10dp"
                     android:left="10dp" />
        </shape>
    </item>


    <item>
        <shape xmlns:android="http://schemas.android.com/apk/res/android"
               android:shape="oval">
            <solid
                android:color="@color/recordingRed"/>
            <size
                android:width="40dp"
                android:height="40dp" />
        </shape>
    </item>



</layer-list>

广场:

                                       

        <padding android:bottom="10dp"
                 android:top="10dp"
                 android:right="10dp"
                 android:left="10dp" />
    </shape>
</item>

<item>
    <shape xmlns:android="http://schemas.android.com/apk/res/android"
           android:shape="rectangle">
        <solid
            android:color="@color/recordingRed"/>
        <size
            android:width="20dp"
            android:height="20dp" />
        <corners android:topLeftRadius="3dp" android:topRightRadius="3dp"
                 android:bottomLeftRadius="3dp" android:bottomRightRadius="3dp"/>
    </shape>
</item>

这适用于例如Nexus 6P或Nexus 5.但是使用小米Redmi 3,这两个图标在第一次显示时显示正常,但是当来回切换时,它们会显示像这样:

enter image description here

enter image description here

然后我发现我需要完全关闭应用程序并再次启动它们才能正常显示。他们第一次出现时看起来很好看。怎么会发生这种情况?

这就是我改变图像的方式:

    mRecordButton.setImageResource(R.drawable.stop_recording_border);

或者:

    mRecordButton.setImageResource(R.drawable.start_recording_border);

0 个答案:

没有答案
相关问题