-1

Since I want to use buttonTint on versions < 21, I need to switch from RadioButton to AppCompatRadioButton. Unfortunately the button is not shown on the device (Android 5.1). It's strange because the android:text of the AppCompatRadioButton works, so that means that the button basically works. Only the circle is not shown. Any ideas why? I also tried to set other color attributes which come with AppCompatRadioButton. It didn't work either. I also updated to the latest compatibility package, I moved the button inside the xml to another position, but nothing works.

This is the xml definition:

<android.support.v7.widget.AppCompatRadioButton
    android:id="@+id/radio_bronze_monthly"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:onClick="onBillingRadioButtonClicked"
    android:text="@string/bronze_monthly"
    android:textColor="@color/black"
    android:textSize="@dimen/default_text_size"
    app:buttonTint="@color/black"
    app:colorAccent="@color/black"
    app:colorPrimary="@color/black"
    app:colorPrimaryDark="@color/black"/>
Bevor
  • 8,396
  • 15
  • 77
  • 141

3 Answers3

1

I figured out what was wrong: Inside the Activity declaration in AndroidManifest, I set my own transparent theme which is used in other Activities too:

<activity
    android:name=".domain.billing.BillingActivity"
    android:noHistory="true"
    android:screenOrientation="portrait"
    android:theme="@style/Theme.Transparent">
</activity>

This is from styles.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">

    <style name="Theme.Transparent" parent="android:Theme">
        <item name="android:windowIsTranslucent">true</item>
        <item name="android:windowBackground">@android:color/transparent</item>
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:backgroundDimEnabled">false</item>
    </style>

<!--more styles -->
</resources>

if I omit this line, it works:

android:theme="@style/Theme.Transparent"
Bevor
  • 8,396
  • 15
  • 77
  • 141
0

Build design library in build.gradle(App) module

Pawan Soni
  • 860
  • 8
  • 19
  • compile 'com.android.support:appcompat-v7:24.0.0' compile 'com.android.support:design:24.0.0' try to compile both – Pawan Soni Dec 11 '17 at 04:47
0

I have Android 5.1 and quickly tried it out, it is working fine for me like this. I just put it inside the default constraint layout, but that should not make a difference.

<android.support.v7.widget.AppCompatRadioButton
    android:id="@+id/radio_bronze_monthly"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:buttonTint="@android:color/black"
    android:text="asdf"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent" />
LCH
  • 16
  • 2