I need to apply two content view same time. That mean i add an image in layout. Then need to plot some dots on a canvas. so here is the code.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
canvas cs = new canvas(this);
setContentView(cs);
setContentView(R.layout.car_kdu);
}
If someone can please help me.i got only one content at a time. But i need both..
That's not possible. Both ImageView and the Canvas will need to be in a single layout that you set using setContentView() .
Your layout will need to be something like.
<LinearLayout android:layout_width="match_parent android:layout_height="match_parent"
android:orientation="vertical">
<ImageView android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" />
<com.my.Canvas android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" />
</LinearLayout>
That will create a layout with both views sharing the space 50%.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.