allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
dependencies {
compile 'com.github.kam520c:KeyBoardView:1.0'
}
public class MainActivity extends AppCompatActivity {
MyKeyBoardView keyboardView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
keyboardView = (MyKeyBoardView) findViewById(R.id.keyboardView);
EventBus.getDefault().register(this);
}
@Override
protected void onDestroy() {
super.onDestroy();
EventBus.getDefault().unregister(this);
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void getEditText(final KamEditText myEditText) {
keyboardView.setEditText(myEditText);
}
}
xml中:
<com.example.kamkeyboard.custom.MyKeyBoardView
android:id="@+id/keyboardView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
edittext:
<com.example.kamkeyboard.custom.KamEditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"/>