A signature drawing custom view for Android.
public class MainActivity extends AppCompatActivity {
SignatureView signatureView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
signatureView = new SignatureView(this); // Or inflate it from XML
setContentView(signatureView);
}
}
You can also add it in xml and then get a reference.
You can add options at the top , and listen for events. In the screenshots i have added the the save option. The options are automatically placed in a grid.
signatureView.addOption(new Option("Save ",R.drawable.ic_save));
signatureView.setOptionClickListener(new OptionClickListener() {
@Override
public void clickedOnOption(Option option) {
Log.i("Clicked on option !",option.getTitle());
}
});The signature view automatically removes the buttons at the top and black border to give you a bitmap which you can save.
Bitmap bitmap = signatureView.getSignatureBitmap();In your project level gradle file, add this
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}And then add the dependency in your app level gradle file
dependencies {
compile 'com.github.Sushobh:SignatureView:master-SNAPSHOT'
}
