我正在尝试从适配器重新加载我的MainActivity。请找到以下代码:
from kivy.app import App
from kivy.uix.floatlayout import FloatLayout
from kivy3 import Renderer, Scene
from kivy3 import PerspectiveCamera
from kivy3.extras.geometries import BoxGeometry
from kivy3.core.geometry import Geometry
from kivy3 import Material, Mesh
import numpy
from stl import mesh
class My3DApp(App):
def _adjust_aspect(self, *args):
rsize = self.renderer.size
aspect = rsize[0] / float(rsize[1])
self.renderer.camera.aspect = aspect
def rotate_cube(self, *dt):
self.cube.rotation.y += 1
def build(self):
layout = FloatLayout()
self.renderer = Renderer()
scene = Scene()
cube_geo = BoxGeometry(1,1,1)
cube_mat = Material()
self.cube = Mesh(
geometry = cube_geo,
material=cube_mat
)
self.cube.pos.z = -5
self.stlfile = mesh.Mesh.from_file('exStl/test01.STL')
print(self.stlfile)
self.camera = PerspectiveCamera(
fov=75,
aspect = 0,
near=1,
far=10
)
scene.add(self.stlfile)
scene.add(self.cube)
self.renderer.render(scene, self.camera)
self.renderer.bind(size=self._adjust_aspect)
layout.add_widget(self.renderer)
Clock.schedule_interval(self.rotate_cube, .01)
#layout.add_widget(Builder.load_string(kv))
return layout
if __name__=="__main__":
My3DApp().run()
问题是,即使在添加此代码块之后,在重新加载活动期间仍会出现闪烁动画。
在适配器内部,我显示一个对话框。按下按钮后,对话框将导致重新加载活动。
在onBindViewHolder()中:
activity = (Activity) context;
activity.finish();
activity.overridePendingTransition(0, 0);
Intent intent =((Activity) context).getIntent();
intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
context.startActivity(intent);
activity.overridePendingTransition(0, 0);
在聊天记录中,我正在调用ShowChatDialog():
viewHolder.txtv_name.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v)
{
int_timer = 0;
tickValue = true;
timerGroupChatHistory.start();
getChatHistory(alst_Dealitem.get(i));
}
});
我有什么遗漏的吗?请帮忙。提前谢谢。