You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+98-3Lines changed: 98 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,14 @@
6
6
7
7
**`MultiFontView`** library can be used to select custom fonts for the view dynamically in your XML. The library loads the custom fonts using a font cache.
#### *STEP 2 - copy the fonts to assets folder under fonts subfolder*
51
82
@@ -54,7 +85,7 @@ To Use MultiFont EditText, add the below dependency
54
85
55
86
#### *STEP 3 - create an attrs.xml file (if already present then add) a declare-stylable and attribute name typeface_from_list which contains the custom fonts in form of enums - as shown below*
56
87
57
-
For `MultiFontTextview` the declare-styleable should be named `MultiFontTextview` and attribute should be named `typeface_from_list`
88
+
For `MultiFontTextView` the declare-styleable should be named `MultiFontTextView` and attribute should be named `typeface_from_list`
58
89
59
90
```groovy
60
91
<attr name="typeface_from_list">
@@ -64,7 +95,7 @@ For `MultiFontTextview` the declare-styleable should be named `MultiFontTextview
64
95
<enum name="Shine.ttf" value="3" />
65
96
<enum name="SweetSensations.ttf" value="4" />
66
97
</attr>
67
-
<declare-styleable name="MultiFontTextview">
98
+
<declare-styleable name="MultiFontTextView">
68
99
<attr name="typeface_from_list" />
69
100
</declare-styleable>
70
101
```
@@ -99,6 +130,51 @@ For `MultiFontEditText` the declare-styleable should be named `MultiFontEditText
99
130
</declare-styleable>
100
131
```
101
132
133
+
For `MultiFontSwitch` the declare-styleable should be named `MultiFontSwitch` and attribute should be named `typeface_from_list`
134
+
135
+
```groovy
136
+
<attr name="typeface_from_list">
137
+
<enum name="BLESSED.otf" value="0" />
138
+
<enum name="Respective.ttf" value="1" />
139
+
<enum name="Respective_Slanted.ttf" value="2" />
140
+
<enum name="Shine.ttf" value="3" />
141
+
<enum name="SweetSensations.ttf" value="4" />
142
+
</attr>
143
+
<declare-styleable name="MultiFontSwitch">
144
+
<attr name="typeface_from_list" />
145
+
</declare-styleable>
146
+
```
147
+
148
+
For `MultiFontRadioButton` the declare-styleable should be named `MultiFontRadioButton` and attribute should be named `typeface_from_list`
149
+
150
+
```groovy
151
+
<attr name="typeface_from_list">
152
+
<enum name="BLESSED.otf" value="0" />
153
+
<enum name="Respective.ttf" value="1" />
154
+
<enum name="Respective_Slanted.ttf" value="2" />
155
+
<enum name="Shine.ttf" value="3" />
156
+
<enum name="SweetSensations.ttf" value="4" />
157
+
</attr>
158
+
<declare-styleable name="MultiFontRadioButton">
159
+
<attr name="typeface_from_list" />
160
+
</declare-styleable>
161
+
```
162
+
163
+
For `MultiFontCheckBox` the declare-styleable should be named `MultiFontCheckBox` and attribute should be named `typeface_from_list`
164
+
165
+
```groovy
166
+
<attr name="typeface_from_list">
167
+
<enum name="BLESSED.otf" value="0" />
168
+
<enum name="Respective.ttf" value="1" />
169
+
<enum name="Respective_Slanted.ttf" value="2" />
170
+
<enum name="Shine.ttf" value="3" />
171
+
<enum name="SweetSensations.ttf" value="4" />
172
+
</attr>
173
+
<declare-styleable name="MultiFontCheckBox">
174
+
<attr name="typeface_from_list" />
175
+
</declare-styleable>
176
+
```
177
+
102
178
If you are using `all the views` or `any two views` just one typeface_from_list is enough as shown below
103
179
```groovy
104
180
<attr name="typeface_from_list">
@@ -108,7 +184,7 @@ If you are using `all the views` or `any two views` just one typeface_from_list
108
184
<enum name="Shine.ttf" value="3" />
109
185
<enum name="SweetSensations.ttf" value="4" />
110
186
</attr>
111
-
<declare-styleable name="MultiFontTextview">
187
+
<declare-styleable name="MultiFontTextView">
112
188
<attr name="typeface_from_list" />
113
189
</declare-styleable>
114
190
@@ -119,6 +195,19 @@ If you are using `all the views` or `any two views` just one typeface_from_list
119
195
<declare-styleable name="MultiFontEditText">
120
196
<attr name="typeface_from_list" />
121
197
</declare-styleable>
198
+
199
+
<declare-styleable name="MultiFontSwitch">
200
+
<attr name="typeface_from_list" />
201
+
</declare-styleable>
202
+
203
+
<declare-styleable name="MultiFontRadioButton">
204
+
<attr name="typeface_from_list" />
205
+
</declare-styleable>
206
+
207
+
<declare-styleable name="MultiFontCheckBox">
208
+
<attr name="typeface_from_list" />
209
+
</declare-styleable>
210
+
122
211
```
123
212
124
213
#### *STEP 4 - create a string array with name `customFonts` and declare all the name of the custom fonts with file extension in the `same order` as `typeface_from_list` enum- as shown below*
@@ -141,6 +230,12 @@ If you are using `all the views` or `any two views` just one typeface_from_list
0 commit comments