I have a relative layout and some textviews in it... I defined this relative layout in the java, and add a view to it. but in the result I just have the view that I added to layout .. and it doesn't show any text boxes..
SampleView sample= new SampleView(this);
rl=(RelativeLayout) findViewById(R.id.rl);
rl.addView(sample);
how can I fix it? (in this code, it just shows the sample view's object ... not textviews that I have in the layout)
Debugging is your solution.
And finally use Android Studio layouting tool, to have a preview of your layout. You can use tools to generate something suitable for preview.
I solved it. my mistake was:
canvas.drawColor(Color.WHITE);
in the onDraw ...
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.