android日志信息是 “W/OpenGLRenderer: Incorrectly called buildLayer on View”,这是什么意思?

标签 android android-layout

这是这个android fragment 的 View

this is the view of this android fragment

下面是 float 按钮部分代码:

<FrameLayout
    android:id="@+id/dialpad_floating_action_button_container"
    android:background="@drawable/fab_green"
    android:layout_width="@dimen/floating_action_button_width"
    android:layout_height="@dimen/floating_action_button_height"
    android:layout_above="@id/dialpad_floating_action_button_margin_bottom"
    android:layout_centerHorizontal="true">

    <ImageButton
        android:id="@+id/dialpad_floating_action_button"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/floating_action_button"
        android:contentDescription="@string/description_dial_button"
        android:src="@drawable/fab_ic_call"/>

</FrameLayout>

但是,Android studio 打印信息:

W/OpenGLRenderer: Incorrectly called buildLayer on View: FrameLayout, destroying layer...
W/OpenGLRenderer: Incorrectly called buildLayer on View: AppCompatImageButton, destroying layer...

而且 float 按钮不显示...

我已经尝试了很多,但仍然不知道它是如何发生的,以及如何检查原因。任何人都可以帮我吗?非常感谢!

最佳答案

最后,我解决了这个问题。 布局xml文件有错误,这是错误的文件内容:

<RelativeLayout
        android:layout_height="match_parent"
        android:layout_width="0dp"
        android:layout_weight="6">

        <include layout="@layout/dialpad_view"
                 android:layout_height="match_parent"
                 android:layout_width="match_parent"
                 android:id="@+id/dialpad_floating_action_button_container"/>

        <!-- "Dialpad chooser" UI, shown only when the user brings up the
                 Dialer while a call is already in progress.
                 When this UI is visible, the other Dialer elements
                 (the textfield/button and the dialpad) are hidden. -->

        <ListView android:id="@+id/dialpadChooser"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/background_dialer_light"
                android:visibility="gone" />

        <!-- Margin bottom and alignParentBottom don't work well together, so use a Space instead. -->
        <Space android:id="@+id/dialpad_floating_action_button_margin_bottom"
            android:layout_width="match_parent"
            android:layout_height="@dimen/floating_action_button_margin_bottom"
            android:layout_alignParentBottom="true" />
        <FrameLayout
            android:id="@+id/dialpad_floating_action_button_container"
            android:background="@drawable/fab_green"
            android:layout_width="@dimen/floating_action_button_width"
            android:layout_height="@dimen/floating_action_button_height"
            android:layout_above="@id/dialpad_floating_action_button_margin_bottom"
            android:layout_centerHorizontal="true">
            <ImageButton
                android:id="@+id/dialpad_floating_action_button"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@drawable/floating_action_button"
                android:contentDescription="@string/description_dial_button"
                android:src="@drawable/fab_ic_call"/>
        </FrameLayout>        

    </RelativeLayout>

“”标签有一个 id 女巫与下面“”的 id 相同。我意识到也许我把这个 id 复制到了错误的地方。 所以,我只是删除了这个 id, float 按钮显示如我所料;

下面是正确的内容:

<RelativeLayout
        android:layout_height="match_parent"
        android:layout_width="0dp"
        android:layout_weight="6">

        <include layout="@layout/dialpad_view"
                 android:layout_height="match_parent"
                 android:layout_width="match_parent"/>

        <!-- "Dialpad chooser" UI, shown only when the user brings up the
                 Dialer while a call is already in progress.
                 When this UI is visible, the other Dialer elements
                 (the textfield/button and the dialpad) are hidden. -->

        <ListView android:id="@+id/dialpadChooser"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/background_dialer_light"
                android:visibility="gone" />

        <!-- Margin bottom and alignParentBottom don't work well together, so use a Space instead. -->
        <Space android:id="@+id/dialpad_floating_action_button_margin_bottom"
            android:layout_width="match_parent"
            android:layout_height="@dimen/floating_action_button_margin_bottom"
            android:layout_alignParentBottom="true" />
        <FrameLayout
            android:id="@+id/dialpad_floating_action_button_container"
            android:background="@drawable/fab_green"
            android:layout_width="@dimen/floating_action_button_width"
            android:layout_height="@dimen/floating_action_button_height"
            android:layout_above="@id/dialpad_floating_action_button_margin_bottom"
            android:layout_centerHorizontal="true">
            <ImageButton
                android:id="@+id/dialpad_floating_action_button"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@drawable/floating_action_button"
                android:contentDescription="@string/description_dial_button"
                android:src="@drawable/fab_ic_call"/>
        </FrameLayout>       

    </RelativeLayout>

关于android日志信息是 “W/OpenGLRenderer: Incorrectly called buildLayer on View”,这是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40839591/

相关文章:

android - Activity 中的广播接收器

android - 我可以在 android 中自定义多选警报对话框吗?

java - ImageView 上的透明背景 EditText 不会显示光标

android - 在谷歌地图项目中膨胀类 fragment 时出错

android - 发布版本中的 ActionBar 缺少后退箭头,但调试版本中没有

android - 如何以编程方式在自定义标题栏上设置背景颜色渐变?

android - BottomSheetDialogFragment - 如何设置扩展高度(或最小顶部偏移)

android - 如何获得 Canvas 区域点击?

android - 如何配置 ProGuard 以保留内部类成员的名称?

android - 将新 AdMob 添加到 Android 应用程序时出现问题