I'm investigating how to customize Digits within my app in the following ways:
I'd love feedback from anyone with experience using Digits on if it is the correct tool for what I want to do and, if so, how I would approach these customizations.
You can check out Cannonball Sample project , which is open source. To change the text of the DigitsAuthButton, you can add a customized Digits button by extending the DigitsAuthButton:
public class DigitsRegisterButton extends DigitsAuthButton {
public DigitsRegisterButton(Context c) {
super(c);
init();
}
public DigitsRegisterButton(Context c, AttributeSet attrs) {
super(c, attrs);
init();
}
public DigitsRegisterButton(Context c, AttributeSet attrs, int defStyle) {
super(c, attrs, defStyle);
init();
}
private void init() {
if (isInEditMode()) {
return;
}
setBackgroundResource(R.drawable.digits_button_bg);
// Modifying the text here..
setText(getResources().getString(R.string.digits_register_text));
setTextColor(getResources().getColor(R.color.theme_color));
}
}
And then you can use and customize this inside your layouts as:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.pinchat.pinchat.view.DigitsRegisterButton
android:id="@+id/signup_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/digits_button_bg"
android:text="@string/digits_register_text"
android:textColor="@color/theme_color"
android:textSize="@dimen/digits_register_btn_text"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:drawableStart="@drawable/ic_signin_phone"
android:drawableLeft="@drawable/ic_signin_phone"/>
</RelativeLayout>
I haven't experimented with the second query of yours. But since the code is open source, you can have a look at it - Digits on GitHub . This repository also has a sample which is worth looking at.
Most easy way to customize the DigitsAuthButtonbutton would be following below:
Hope this helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.