Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>XML : </p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" &gt; &lt;ImageView android:id="@+id/iv_tree" android:scaleType="fitXY" android:layout_width="fill_parent" android:layout_height="fill_parent" android:adjustViewBounds="true" android:src="@drawable/my_tree" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p>MyView.java :</p> <pre><code>public MyView extends View{ private Bitmap head_1, head_2; public MyView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); this.context = context; init(); } public MyView(Context context, AttributeSet attrs) { super(context, attrs); this.context = context; init(); } public MyView(Context context) { super(context); this.context = context; init(); } private void init(){ head_1= BitmapFactory.decodeResource(context.getResources(), R.drawable.head_1); head_2= BitmapFactory.decodeResource(context.getResources(), R.drawable.head_2); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); canvas.drawBitmap(head_1, coordinateX_head_1, coordinateY_head_1, null); canvas.drawBitmap(head_2, coordinateX_head_2, coordinateY_head_2, null); } } </code></pre> <p>You choose the coordinate you want, you can even use function like canvas.getWidth() or canvas.getHeight(). Pose yourself as a painter. Good luck.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload