gpt4 book ai didi

android - A/OpenGL渲染器 : Error: Ambient Index Buffer overflow

转载 作者:可可西里 更新时间:2023-11-01 11:41:24 25 4
gpt4 key购买 nike

我在两个 fragment 之间有一个卡片翻转动画,它在动画中途崩溃了。我已经尝试在动画发生的地方设置一个断点(调试动画的新手,让我根据下面的代码知道,我应该在哪里设置断点),但是我没有找到罪魁祸首。当应用程序崩溃时,我收到的唯一错误消息如下:

A/OpenGLRenderer: Error: Ambient Index Buffer overflow!!! used 300, total 298

A/libc: Fatal signal 5 (SIGTRAP), code 1 in tid 9338 (hwuiTask2)

import android.animation.AnimatorInflater;
import android.animation.AnimatorSet;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
public class AnswerActivity extends AppCompatActivity implements FragmentManager.OnBackStackChangedListener {

private AnimatorSet mSetRightOut;
private AnimatorSet mSetLeftIn;

private View mCardFrontLayout;
private View mCardBackLayout;

private Handler mHandler = new Handler();
private boolean mIsBackVisible = false;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_answer_activity);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);

FragmentManager manager = getFragmentManager();

if (savedInstanceState == null) {
FragmentTransaction transaction = manager.beginTransaction();

// transaction.add(R.id.q_fragment, questionFragment, "fragmentQ");
transaction.add(R.id.q_fragment, SingleQuestionFragment.newInstance());
// transaction.add(R.id.a_fragment, answerFragment, "fragmentA");
// transaction.add(R.id.a_fragment, SingleAnswerFragment.newInstance());
transaction.add(R.id.a_fragment, new CardFront());
transaction.commit();

//right spot?
// findViews();
// loadAnimations();
// changeCameraDistance();

} else {
mIsBackVisible = (getFragmentManager().getBackStackEntryCount() > 0);
}

getFragmentManager().addOnBackStackChangedListener(this);

}

@Override
protected void onDestroy() {
super.onDestroy();
}

private void changeCameraDistance() {
int distance = 8000;
float scale = getResources().getDisplayMetrics().density * distance;
mCardFrontLayout.setCameraDistance(scale);
mCardBackLayout.setCameraDistance(scale);
}

private void loadAnimations() {
mSetRightOut = (AnimatorSet) AnimatorInflater.loadAnimator(this, R.animator.out_animation);
mSetLeftIn = (AnimatorSet) AnimatorInflater.loadAnimator(this, R.animator.in_animation);
}

private void findViews() {
mCardBackLayout = findViewById(R.id.card_back);
mCardFrontLayout = findViewById(R.id.card_front);
}

public void flipCard(View view) {
// if (!mIsBackVisible) {
// mSetRightOut.setTarget(mCardFrontLayout);
// mSetLeftIn.setTarget(mCardBackLayout);
// mSetRightOut.start();
// mSetLeftIn.start();
// mIsBackVisible = true;
// } else {
// mSetRightOut.setTarget(mCardBackLayout);
// mSetLeftIn.setTarget(mCardFrontLayout);
// mSetRightOut.start();
// mSetLeftIn.start();
// mIsBackVisible = false;
// }

if(mIsBackVisible) {
getFragmentManager().popBackStack();
return;
}

mIsBackVisible = true;

getFragmentManager()
.beginTransaction()
// .setCustomAnimations(R.anim.new_in_animation, R.anim.new_out_animation)
.setCustomAnimations(R.animator.in_animation, R.animator.out_animation)
.replace(R.id.a_fragment, SingleAnswerFragment.newInstance())
.addToBackStack(null)
.commit();


}

@Override
public void onBackStackChanged() {
mIsBackVisible = (getFragmentManager().getBackStackEntryCount() > 0);
}

}

最佳答案

我遵循了 tufekoi 的解决方案,并将我的根布局从 cardView 更改为 FrameLayout,它成功了,就这么简单。

关于android - A/OpenGL渲染器 : Error: Ambient Index Buffer overflow,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35993039/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com