public class MainActivity extends Activity {
private String TAG=MainActivity.class.getSimpleName();
EditText editText;
TextView textView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
editText=(EditText)this.findViewById(R.id.inputText);
textView=(TextView)this.findViewById(R.id.viewText);
editText.setOnKeyListener(new OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
textView.setText(editText.getText());
Linkify.addLinks(textView, Linkify.EMAIL_ADDRESSES|Linkify.PHONE_NUMBERS|Linkify.WEB_URLS);
return false;
}
});
}
}
--------------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_marginTop="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:autoLink="web"
android:text="http://www.517dv.com" />
<EditText
android:layout_marginTop="5dp"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="@+id/inputText">
</EditText>
<TextView
android:layout_marginTop="5dp"
android:layout_height="wrap_content"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="fill_parent"
android:id="@+id/viewText"
android:text=""></TextView>
</LinearLayout>