获取方法(gradle)
compile 'thereisnospon.codeview:codeview:0.3.1'
然后就获取好了,如果有问题,那应该是被墙的锅。
具体使用方法,非常简单,首先在 layout文件中
<thereisnospon.codeview.CodeView
android:id="@+id/codeview"
android:layout_width="match_parent"
android:layout_height="match_parent">
</thereisnospon.codeview.CodeView>
然后在代码中使用它,就像这样
public class MainActivity extends AppCompatActivity {
CodeView codeView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
codeView=(CodeView)findViewById(R.id.codeview);
codeView.setTheme(CodeViewTheme.ANDROIDSTUDIO).fillColor();
//这里的CODE 为需要显示的代码,类型为String,使用的时候自己替换下。
codeView.showCode(CODE);
}
}
没个电脑吗
把java文件里面的所有单词扫描出来,如果是匹配到对应的关键字的就给他换颜色。