Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You should use RelativeLayout to solve this problem. I've gone through a similar problem once... </p> <p>I didn't use the the Android's default buttons, for I had my own images for the pressed and unpressed behaviors...</p> <p>Let suppose you want to place the east "button". You could use a function like:</p> <pre><code>public void addEastImageView(RelativeLayout myBackgroundLayout, ImageView center, ImageView east, int leftPadding, int topPadding, int rightPadding, int bottomPadding){ RelativeLayout.LayoutParams rightSide = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); rightSide.addRule(RelativeLayout.RIGHT_OF, center.getId()); east.setPadding(leftPadding, topPadding, rightPadding, bottomPadding); myBackgroundLayout.addView(east, rightSide); } </code></pre> <p>The ImageView called "center" would be the one you called "i" in your image. The padding parameters would allow you to control the distance between the ImageViews. You can create functions like this one to add the "west", "south" and "north" buttons also: you just have to change the parameter "RelativeLayout.RIGHT_OF" to "RelativeLayout.LEFT_OF", "RelativeLayout.BELLOW" and "RelativeLayout.ABOVE" accordingly. </p> <p>If you want some behavior for your ImageViews, you just have to set it in the <a href="http://developer.android.com/reference/android/view/View.html#setOnClickListener%28android.view.View.OnClickListener%29" rel="nofollow">setOnClickListener</a>. You can then change your ImageView's "image" with <a href="http://developer.android.com/reference/android/view/View.html#setBackgroundResource%28int%29" rel="nofollow">setBackgroundResource</a>, for example, and set the others logic behaviors you want.</p> <p>Hope it helps :D</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. VO
      singulars
      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