Skip to content

Commit 1024685

Browse files
committed
Support radio button appearance in Android
1 parent 6609084 commit 1024685

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

checkbox.android.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,14 @@ export const tintColorProperty = new CssProperty<Style, string>({
4141
}
4242
});
4343

44+
export const enum BoxType {
45+
Circle = 1,
46+
Square = 2
47+
}
48+
4449
export class CheckBox extends View implements CheckBoxInterface {
4550
private _android: any; /// android.widget.CheckBox
51+
private _boxType: number;
4652
private _checkStyle: string;
4753
private _checkPadding: string;
4854
private _checkPaddingLeft: string;
@@ -58,6 +64,14 @@ export class CheckBox extends View implements CheckBoxInterface {
5864
return this._android;
5965
}
6066

67+
set boxType(value: number) {
68+
this._boxType = value;
69+
}
70+
71+
get boxType() {
72+
return this._boxType;
73+
}
74+
6175
get checkStyle() {
6276
return this._checkStyle;
6377
}
@@ -140,10 +154,11 @@ export class CheckBox extends View implements CheckBoxInterface {
140154
}
141155

142156
public createNativeView() {
143-
this._android = new android.support.v7.widget.AppCompatCheckBox(
144-
this._context,
145-
null
146-
);
157+
this._android = new android.support.v7.widget[
158+
this.boxType == BoxType.Circle
159+
? "AppCompatRadioButton"
160+
: "AppCompatCheckBox"
161+
](this._context, null);
147162
if (this.checkPaddingLeft) {
148163
this._android.setPadding(
149164
parseInt(this.checkPaddingLeft),

0 commit comments

Comments
 (0)