Preparing customized radio group type of layout

前端 未结 7 576
生来不讨喜
生来不讨喜 2020-12-30 08:49

I am trying to prepare custom radiogroup like layout in the below image. I have nearly 8-10 rows to do that. So, I prepared one linear layout w

7条回答
  •  死守一世寂寞
    2020-12-30 09:13

    I edited the layout removing the second part, which was useless for your purpose.
    If you look at the layout, you will see what is the trick to put the button on the right.
    This can be made in code, too, if you don't want to use the layout (why?)
    Using my layout (without the need for a cusom class), the result you'd get is...

    enter image description hereenter image description hereenter image description here

    Quite similar to your goal, isn't it?

    The tricky lines you'll want to replicate in your code (again, why?) are:

    android:button="@null"
    android:drawableRight="@android:drawable/btn_radio" // or your selector, with custom on/off pngs
    android:drawableLeft="@drawable/ic_launcher" // or whatever
    

提交回复
热议问题