Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Of course there are a lot of possible solutions. One easy one is:</p> <ul> <li>utilize a standard ListView</li> <li>let a custom adapter (extend BaseAdapter for this purpose) fill each row</li> <li>the layout for a list item should use a LinearLayout with horizontal orientation</li> <li>create a custom widget only for the "/" divider</li> <li>in the layout for a list item put an ImageView (for the celeb picture) and add as menu of your custom "/" widgets you need</li> </ul> <p>For your custom widget I suggest to extend an existing Android widget instead of buildung one from scratch. To extend a FrameLayout might be a good solution because you can have a recangular background which is overlayed by a triangular overlay. With an onTouchListener you can detect which of them is clicked.</p> <p>This way the effort of creating such widget would be minimized by the use of as much standard solutions as possible.</p> <p>Here is one abstract example implementation of your custom widget:</p> <pre><code> public class DividedView extends FrameLayout implements OnTouchListener { public void onCreate(Context context, AttributeSet attr){ View firstView = createFirstView(); View secondView = createSecondView(); //this view has a triangle shape but with a transparent buttom-right corner... but the boundaries match the complete size of this custom widget... therefore this view consumes all touch events secondView.setOnTouchListener(this); addView(firstView); addView(secondView); } ... public boolean onTouch(MotionEvent event){ switch(event.getAction(){ case MotionEvent.ACTION_DOWN: //detect if coordinates of touch down are in boundaries of first or second view... if yes trigger click event for firstView or secondView depending on coordinates break; } } //via this method you can set corresponding click listener for each of the divided views public void setFirstViewOnClickListener(OnClickListener onClickListener) ... } </code></pre>
    singulars
    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.
 

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