Home > Net >  Is it good to use radio button instead of ImageView for just displaying purpose in android?
Is it good to use radio button instead of ImageView for just displaying purpose in android?

Time:05-13

I have a design where the image view looks like a radio button but serves no purpose of radio checked/ unchecked. Since it looks like a radio button, is it good to use a radio button which state enabled and user interaction off, instead of having an image view with image added in the project?

Which is the better approach? What extra burder does the system have in having imageview or radio button instead of the other one?

screenshot of the design

CodePudding user response:

You can add drawable to your TextView in xml as

app:drawableStartCompat="@drawable/icon"

So, there is no need of using ImageView or RadioButton

Or you can use simple View and constraint it with your textView

      <View
        android:id="@ id/view"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/ring"
        app:layout_constraintBottom_toBottomOf=""
        app:layout_constraintEnd_toStartOf=""
        app:layout_constraintStart_toStartOf=""
        app:layout_constraintTop_toTopOf="" />

CodePudding user response:

As far as the system goes, there is no burden. The burden is however on the developer and the maintainer of the project. Putting an imageview where actually the functionality is for a radio button complicates matters for no reason. If the intent is to show options/choices, then radio button is the obvious choice. It's intuitive to the user as well and of course straight forward to code.

  • Related