jeudi 21 mai 2015

Style of RadioButton magically changes when put into a Listview?

I made a DialogFragment with a RadioButton ontop and a ListView below containing more RadioButtons. And now I'm just wondering what style the ListView uses that the RadioButtons don't look the same as the "stand-alone" one.

Here is a snippet of my dialog.xml

<LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@id/buttonGroup"
        android:layout_alignParentTop="true"
        android:orientation="vertical">

        <RadioButton
            android:id="@+id/none"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/none" />

        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="@android:color/white" />

        <ListView
            android:id="@+id/conferences"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
</LinearLayout>

And my list_item.xml that I inflate as the rows in getView of my ArrayAdapter:

<?xml version="1.0" encoding="utf-8"?>
<RadioButton xmlns:android="http://ift.tt/nIICcg"
    android:id="@+id/conference"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />

My AppTheme is based on "Theme.AppCompat". I didn't change any style of a specific item in my View.

The "stand-alone" RadioButton has a white circle with a blue dot when selected and even has a different style while you press it down. The RadioButtons in the ListView are all black with a black dot and don't have a "press-down" style. It would be cool if I wouldn't need to programatically set styles for not checked/"press-down"/checked. I already tried to set 2 base Android themes that had "RadioButton" in their names on the ListView but nothing changed. Maybe there is a way to get the style of the "stand-alone" RadioButton and set it in the xml files for the other RadioButtons?

I would post an image but I'm new here so not already allowed to do this =D

Aucun commentaire:

Enregistrer un commentaire