Office Hours Transcript: 2021-06-24
Ivano_ndrocchietto joined
Ivano_ndrocchietto left
IvanoNoSpaces joined
Hello Mark
whoops, hello, Ivano!
how can I help you today?
ehy, this new chat does not have notifications with sound sorry was on another page
if you open the sidebar, there are notification options, but they seem to be mostly for cases where you use @ syntax, like @IvanoNoSpaces
ah ok
well thanks anyway
I am building a radio button and got a bit frustrated because design asked me to populate the text vertically, below the two circles(i am selecting man and woman)
I noticed that this was not easily achievable without writing a custom view
set the text of the RadioButton
to ""
and use separate TextView
widgets for their captions
so I have almost finished to build constraint layout, with an image that takes the two states, checked and unchecked and then I am going to determine the business logic in the view
but I am afraid I am boiling the ocean, and that maybe there was an easier solution to make a radio button with the text below and customize a bit the stroke of the circle as was required
I tried to use this strategy but the text was not recognized vertically but was appearing horizontally cause could not link to the radio button
I guarantee you that you can put things below a RadioButton
Let me see the local history
please
If you remove the caption from the RadioButton
(by setting its text to ""
), you can put a TextView
below it. They will not be connected, insofar as clicks on the TextView
will not toggle the RadioButton
— you would need to handle that in code.
and you can use android:background
on a RadioButton
to swap in a different StateListDrawable
for the checked/unchecked states (along with any other states that you need, such as disabled)
sorry for the time, I got enthusiastic about VIM and applied the plugin do had to disable to copy from history
it does not work to me, this is what I wrote the text is horizontal
android:id="@+id/RadioGroup1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/activity_vertical_margin"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/fragment_nested_user_data_genre_text">
<RadioButton
android:id="@+id/woman_selected"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:layout_marginLeft="@dimen/activity_horizontal_margin" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/woman" />
<RadioButton
android:text=""
android:id="@+id/man_selected"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true" />
</RadioGroup>
that is because your LinearLayout
is horizontal
if you want a vertical LinearLayout
, change android:orientation
to vertical
or, get rid of the LinearLayout
entirely and position the widgets using the parent ConstraintLayout
oh can i use a linear layout?
sorry
contraint Layout?
RadioGroup
is a subclass of LinearLayout
i constraint radio group
you may need to keep the RadioGroup
– I forget if there is a recipe for working without one
the radio button are children i cannot use a constrain there
I think the RadioButton
widgets can be nested further, at least on current versions of Android
so, the RadioGroup
could hold a pair of vertical LinearLayout
containers, each of which hold a RadioButton
and TextView
and if I use a vertical layout, it works indeed that the text is below the first selector, but then the second selector is below
the text
right, you need to do something for another axis here
as a nested linear layout as the old times
but at this point it looks to me is better to use an ImageView with two states as I was doing
yeah, in the end, the custom view may not be a horrible approach – it just gets messy when you start to think about keyboard navigation and other accessibility concerns
and in the view/ view model manage the logic
RadioButton
was not well-designed
is that it looks strange to me android does not furnish an easy solution
well i revert back to my first solution, a nested Linear layout will not be popular in the review I am afraid
OK
and i put back the VIm plugin
alas, that is all the time that I have for the chat today
are you a VIm /emac fan, mark/
the next one is Saturday at 4pm US Eastern
no, I use Sublime Edit
anyway, have a pleasant day!
you too thanks