How to set a particular font for a button text in android?

If you plan to add the same font to several buttons I suggest that you go all the way and implement it as a style and subclass button: public class ButtonPlus extends Button { public ButtonPlus(Context context) { super(context); } public ButtonPlus(Context context, AttributeSet attrs) { super(context, attrs); CustomFontHelper.setCustomFont(this, context, attrs); } public ButtonPlus(Context context, … Read more

What is the default button type?

For most browsers the default type of button is submit. type = submit|button|reset [CI] This attribute declares the type of the button. Possible values: submit: Creates a submit button. This is the default value. (http://www.w3.org/TR/html401/interact/forms.html#h-17.5) The only exception to this is IE7 and below where the default type is button. Windows Internet Explorer 8 and … Read more

How to change background color of react native button

Use this for adding the background color to the button in iOS: Styles: loginScreenButton:{ marginRight:40, marginLeft:40, marginTop:10, paddingTop:10, paddingBottom:10, backgroundColor:’#1E6738′, borderRadius:10, borderWidth: 1, borderColor: ‘#fff’ }, loginText:{ color:’#fff’, textAlign:’center’, paddingLeft : 10, paddingRight : 10 } Button: <TouchableOpacity style={styles.loginScreenButton} onPress={() => navigate(‘HomeScreen’)} underlayColor=”#fff”> <Text style={styles.loginText}>Login</Text> </TouchableOpacity> For Android it simply works with Button color property … Read more

Android Button with rounded corners, ripple effect and no shadow

I finally solved it with below code. This achieve rounded corners for button. Also, for Android Version >= V21, it uses ripple effect. For earlier Android version, button color changes when it is clicked, based on android:state_pressed, android:state_focused, etc. In layout xml file: <Button style=”?android:attr/borderlessButtonStyle” android:id=”@+id/buy_button” android:layout_width=”0dp” android:layout_weight=”1″ android:layout_height=”match_parent” android:gravity=”center” android:background=”@drawable/green_trading_button_effect” android:textColor=”@android:color/white” android:text=”BUY” /> For … Read more