Android Question [SOLVED?] Modifying radiobutton style

JackKirk

Well-Known Member
Licensed User
Longtime User
I'm guessing the title correctly summates the following.

For other reasons, I have added content to my apps manifest as per:

https://www.b4x.com/android/forum/t...efore-designer-script-work.65815/#post-416766

Problem is that now the only visible radio button in a nest is the checked one - all unchecked ones have no visible button - which to me looks a bit too minimalistic.

I'm assuming this is Material Design.

Is there any way to remedy this - I've been searching the forums and googling but am drowning in XML which is most definitely not my strong suit.

Thanks in advance for any help...
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Material design checkboxes look like:

SS-2017-01-08_08.17.22.png
 
Upvote 0

JackKirk

Well-Known Member
Licensed User
Longtime User
Erel, I actually said radiobutton, not checkbox.

What I am seeing is:

no radiobutton.png
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
No problem. They should look like:
SS-2017-01-08_08.58.45.png


I guess that you have set the background to be light instead of selecting a light theme and keeping the default colors.


Correct way to choose a light theme (manifest editor):
B4X:
SetApplicationAttribute(android:theme, "@style/LightTheme")
CreateResource(values-v20, theme.xml,
<resources>
  <style
  name="LightTheme" parent="@android:style/Theme.Material.Light">
  </style>
</resources>
)
CreateResource(values-v14, theme.xml,
<resources>
  <style
  name="LightTheme" parent="@android:style/Theme.Holo.Light">
  </style>
</resources>
)
 
Upvote 0

JackKirk

Well-Known Member
Licensed User
Longtime User
Erel,

As I said in the first post of this thread, this minor problem was introduced when I followed the suggestion in your post:

https://www.b4x.com/android/forum/t...efore-designer-script-work.65815/#post-416766

In that post you suggest:
B4X:
SetApplicationAttribute(android:theme, "@style/NoActionBar")
CreateResource(values-v20, theme.xml,
<resources>
  <style
  name="NoActionBar" parent="@android:style/Theme.Material.NoActionBar">
  </style>
</resources>
)
CreateResource(values-v14, theme.xml,
<resources>
  <style
  name="NoActionBar" parent="@android:style/Theme.Holo.NoActionBar">
  </style>
</resources>
)

Which is obviously very similar to what you are now suggesting above.

I have tried putting both in my manifest but it appears whichever is last in the manifest wins - so I can either have one or the other - is there any way to combine them so that I get both no title bar and proper radiobutton bullets?

Thanks...
 
Upvote 0

JackKirk

Well-Known Member
Licensed User
Longtime User
After a lot of suck'n'see and some more googling I have come up with a solution that seems to give me what I want by putting this in my app's manifest:
B4X:
SetApplicationAttribute(android:theme, "@style/CPSTheme")
CreateResource(values-v20, theme.xml,
<resources>
  <color name="pitch_black">#FF000000</color>
  <style
  name="CPSTheme" parent="@android:style/Theme.Material.Light">
  <item name="android:colorPrimary">@color/pitch_black</item>
  <item name="android:windowBackground">@color/pitch_black</item>
  <item name="android:actionBarSize">0dp</item>
  <item name="android:windowNoTitle">true</item>
  </style>
</resources>
)
CreateResource(values-v14, theme.xml,
<resources>
  <color name="pitch_black">#FF000000</color>
  <style
  name="CPSTheme" parent="@android:style/Theme.Holo.Light">
  <item name="android:colorPrimary">@color/pitch_black</item>
  <item name="android:windowBackground">@color/pitch_black</item>
  <item name="android:actionBarSize">0dp</item>
  <item name="android:windowNoTitle">true</item>
  </style>
</resources>
)
<item name="android:colorPrimary">@color/pitch_black</item>
This gives me a black title background in the apps recents/overview entry.

<item name="android:windowBackground">@color/pitch_black</item>
This gives me a black screen when app is being launched - if left out it is white.

<item name="android:actionBarSize">0dp</item>
This cans the action bar.

<item name="android:windowNoTitle">true</item>
This cans the title.

I am testing on a Samsung S5 running Android 6.0.1 (Marshmallow) and think I am actually using the first block (i.e. parent="@android:style/Theme.Material.Light").

Is there any sneaky way I can test the second block?

Alternatively, could anyone test and/or tell me if the second block works - I read somewhere that colorPrimary was introduced with Lollipop - not exactly sure what this means for the relevance/stability of the second block running on pre-Lollipop devices.


Thanks again...
 
Upvote 0
Top