Skip to content

Instantly share code, notes, and snippets.

@robillo
Created August 11, 2017 19:15
Show Gist options
  • Save robillo/d827a51f1adbde8202457346ff80327d to your computer and use it in GitHub Desktop.
Save robillo/d827a51f1adbde8202457346ff80327d to your computer and use it in GitHub Desktop.
main activity
package com.robillo.customviewstutorial;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
public class MainActivity extends AppCompatActivity {
MyCustomView myCustomView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
myCustomView = (MyCustomView) findViewById(R.id.mcv);
}
public void onClick(View view) {
switch (view.getId()){
case R.id.one:{
myCustomView.customPaddingUp(30);
break;
}
case R.id.two:{
myCustomView.swapColor();
break;
}
case R.id.three:{
myCustomView.customPaddingDown(30);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment