Home > Mobile >  Consulting, a simple question, and set himself to the activity after the view does not display the o
Consulting, a simple question, and set himself to the activity after the view does not display the o

Time:10-27

Because my activity to display a picture, so I used the following way
Public class SetParamActivity extends AppCompatActivity {
@ Override
Protected void onCreate (Bundle savedInstanceState) {
MyDrawView myView=new myDrawView (this);
The setContentView (myView);
}
Public class myDrawView extends the View {
@ Override
Protected void ontouch (Canvas, Canvas) {
}
,,,,,,,
}
}

However, in this way, can't add other controls in the myView, excuse me how to operate?

CodePudding user response:

The setContentView you replace the original with your custom, original, of course, does not show,

CodePudding user response:

You can be in the original XML to add a custom view or in Java code addView (your custom view)