AndroidAceEditor
1.0.0
นี่คือตัวแก้ไขข้อความ/รหัสที่มีไว้สำหรับการรวมเป็นส่วนประกอบแบบแยกส่วนของ UI โดยรวม จุดมุ่งหมายคือการจัดหาเครื่องมือแก้ไขที่ทรงพลังที่สามารถใช้ได้เช่นเดียวกับมุมมองอื่น ๆ
Ece Text Editor ถูกใช้เพื่อจุดประสงค์นี้เนื่องจากมีคุณสมบัติที่หลากหลายเร็วและง่ายต่อการปรับเปลี่ยนและฝังในแอปพลิเคชัน
โปรดทราบว่าปัจจุบันห้องสมุดนี้รองรับ Android Version 5.0 (Lollipop) ขึ้นไป
allprojects {
repositories {
.. .
maven {
url ' https://jitpack.io '
}
}
}dependencies {
.. .
compile ' com.github.Susmit-A:AndroidAceEditor:0.5.0 '
}...
< com .susmit.aceeditor.AceEditor
android : layout_width = " match_parent "
android : layout_height = " match_parent "
android : id = " @+id/editor " />
...กิจกรรมการสาธิต:
public class MainActivity extends Activity {
@ Override
protected void onCreate ( Bundle savedInstanceState ) {
super . onCreate ( savedInstanceState );
setContentView ( R . layout . activity_main );
editor = findViewById ( R . id . editor );
//call this to set up themes or modes at time of creation of view.
//If you are setting the theme or mode through another view's action,
//call setTheme and/or setMode directly
editor . setOnLoadedEditorListener ( new OnLoadedEditorListener () {
@ Override
public void onCreate () {
editor . setTheme ( AceEditor . Theme . TERMINAL );
editor . setMode ( AceEditor . Mode . C_Cpp );
}
});
//Since a WebView is used for the content, you need to set the following listener to process the text
//It is also used to retrive other values, such as selected text or number of lines
editor . setResultReceivedListener ( new ResultReceivedListener () {
@ Override
public void onReceived ( String text , int FLAG_VALUE ) {
if ( FLAG_VALUE == AceEditor . Request . VALUE_TEXT )
{
Toast . makeText ( MainActivity . this , "Typed text: n n " + text , Toast . LENGTH_SHORT ). show ();
}
}
});
}
}