Android尝试在没有动画手柄的情况下启动新的动画师

时间:2018-08-27 02:33:05

标签: android rippledrawable

在AlertDialog中立即单击RecyclerView项 时,应用程序崩溃。我检查了Logcat并收到了此消息

  

A / OpenGLRenderer:尝试在没有动画手柄的情况下在0x74af9d0600(RippleDrawable)上启动新的动画师!

item_dialog.xml

<android.support.constraint.ConstraintLayout android:id="@+id/dialogCL1"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:foreground="@drawable/button_foreground_1"
android:background="@drawable/button_background_1">

<TextView android:id="@+id/dialogTV1"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintRight_toLeftOf="@id/dialogIV1"
    app:layout_constraintBottom_toBottomOf="parent"
    android:layout_marginRight="12dp"
    android:layout_marginTop="14dp"
    android:layout_marginBottom="14dp"
    android:layout_marginLeft="2dp"
    android:textSize="15sp"
    android:textColor="@color/primaryTextColor"
    android:text="Tatacara Pengurusan Jenazah-Mandi"/>

<ImageView android:id="@+id/dialogIV1"
    android:layout_width="24dp"
    android:layout_height="24dp"
    app:layout_constraintDimensionRatio="H, 1:1"
    android:src="@drawable/kelas"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintBottom_toBottomOf="parent"
    android:layout_marginRight="2dp"/>

drawable-v21中的

button_background_1.xml

<ripple
xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/semiPrimary">

<item android:id="@android:id/mask">
    <color android:color="@color/white" />
</item>

<item>
    <selector>
        <item android:drawable="@color/white"/>
    </selector>
</item>

活动内的showContentDialog方法

private void showContentDialog(int titleResource, int colorResource, int stringArrayResource, Bundle bundle)
{
    AlertDialog dialog;
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    View view   = LayoutInflater.from(this).inflate(R.layout.dialog_main, null);
    builder.setView(view);

    ConstraintLayout mainDialogCL1  = view.findViewById(R.id.mainDialogCL1);
    TextView    mainDialogTV1       = view.findViewById(R.id.mainDialogTV1);
    RecyclerView mainDialogRV1      = view.findViewById(R.id.mainDialogRV1);

    mainDialogTV1.setText(getString(titleResource));
    mainDialogCL1.setBackgroundResource(colorResource);

    LinearLayoutManager layoutManager   = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
    DividerItemDecoration itemDecoration    = new DividerItemDecoration(this, DividerItemDecoration.VERTICAL);

    mainDialogRV1.setLayoutManager(layoutManager);
    mainDialogRV1.addItemDecoration(itemDecoration);
    List<Content> contentList = getContentFromResource(stringArrayResource);
    bundle.putInt("COLOR", colorResource);
    bundle.putInt("TITLE", titleResource);
    bundle.putInt("ARRAY", stringArrayResource);
    DialogRVAdapter adapter = new DialogRVAdapter(this, contentList, bundle, true);
    mainDialogRV1.setAdapter(adapter);

    dialog = builder.create();
    dialog.show();
}

0 个答案:

没有答案