I Have two view (.java)that called A view and B view,my main goal is to trigger B view’s onDraw() from A view. After I run BviewInstance.invalidate() in A view,I can only trigger A view’s.
I had tried my best,and didn’t find the answer in the web, hope someone can help me figured out!
public class AView extends View {
private BView B_view;
public AView(Context context, AttributeSet attrs) {
super(context, attrs);
B_view = new BView(context, attrs); ...
} ...
B_view.changeBviewData();
B_view.Invalidate();
...
}
xml:
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black">
<SurfaceView
android:id="@+id/cameraview"
android:layout_width="500dp"
android:layout_height="match_parent"
android:layout_gravity="center" />
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end">
<ImageView
android:id="@+id/hotSpot_imgV"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_gravity="bottom|end"
android:src="@drawable/hotspot_preview" />
<com.tencent.yolov8ncnn.BView
android:id="@+id/BView"
android:layout_width="100dp"
android:layout_height="65dp"
android:layout_gravity="center"
android:visibility="visible" />
</FrameLayout>
<com.tencent.yolov8ncnn.AView
android:id="@+id/AView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:visibility="visible"/>
</FrameLayout>
It only trigger AView ondraw()