Skip to content Skip to sidebar Skip to footer

How To Insert An Image With Canvas?

I´m trying to insert a simple image with canvas in Android with the next code, but when i try to execute in the smartphone, only appears a white screen without image. import andr

Solution 1:

I found the answer: I add a view (Lienzo) to the layout. Answer found in this spanish web.

@OverrideprotectedvoidonCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    RelativeLayoutlayout1= (RelativeLayout) findViewById(R.id.layout1);
    Lienzoimage=newLienzo(this);
    layout1.addView(image);     
}

Thanks Xavier Falempin, you inspired me.

Post a Comment for "How To Insert An Image With Canvas?"