Guest User

Untitled

a guest
Jan 19th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.16 KB | None | 0 0
  1. style="@android:style/Widget.TextView"
  2. android:editable="false"
  3. android:cursorVisible="false"
  4. android:longClickable="false"
  5.  
  6. EditText Et; // initialize your edittext//
  7.  
  8. Et.setCursorVisible(false);
  9. Et.setLongClickable(false);
  10. Et.setClickable(false);
  11. Et.setFocusable(false);
  12. Et.setSelected(false);
  13. Et.setKeyListener(null);
  14. Et.setBackgroundResource(android.R.color.transparent);
  15.  
  16. android:focusable="false"
  17. android:inputType="none"
  18.  
  19. android:longClickable="false"
  20. android:clickable="false"
  21. android:cursorVisible="false"
  22. android:editable="false"
  23.  
  24. <?xml version="1.0" encoding="utf-8" ?>
  25. <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
  26. <solid android:color="#ffffff" />
  27. <stroke android:width="1dip" android:color="#000000"/>
  28. </shape>
  29.  
  30. <TextView
  31. android:layout_width="0dp"
  32. android:layout_weight="1"
  33. android:layout_height="wrap_content"
  34. android:inputType="date"
  35. android:layout_column="1"
  36. android:id="@+id/dateFromTextView"
  37. android:layout_marginRight="3dp"
  38. android:background="@drawable/border"
  39. android:textAppearance="?android:attr/textAppearanceLarge"
  40. android:layout_gravity="center"
  41. android:gravity="center" />
  42.  
  43. <EditText
  44. android:layout_width="match_parent"
  45. android:layout_height="wrap_content"
  46. android:id="@+id/txt_postContent"
  47. android:textSize="17sp"
  48. android:gravity="top|left"
  49. android:text="This is a dummy text "
  50. android:layout_below="@+id/img_empimage"
  51. android:layout_alignParentLeft="true"
  52. android:layout_alignParentStart="true"
  53. android:enabled="false"
  54. android:background="@android:color/transparent"
  55. style="?android:attr/textViewStyle" />
  56.  
  57. yourEditText.setTextColor(Color.parseColor("#000000"));
  58.  
  59. InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
  60. imm.showSoftInput(postContent, InputMethodManager.SHOW_IMPLICIT);//shows keyboard
  61. int position = postContent.length();
  62. Editable text = postContent.getText();
  63. yourEditText.setBackground(getResources().getDrawable(R.drawable.border));//shows a border around your text view making it look like a edit text
  64. yourEditTex.setEnabled(true);//enables the edit text which we disabled in layout file
  65. yourEditTex.setCursorVisible(true);
  66. Selection.setSelection(text,position-1);`//places the cursor at the end of the text
  67.  
  68. String s = postContent.getText().toString();
  69. yourEditText.setText(s);
  70. yourEditText.setEnabled(false);
  71. yourEditText.setTextColor(Color.parseColor("#000000"));
  72. yourEditText.setBackground(null);`
  73.  
  74. <EditText
  75. android:id="@+id/editTextPassword"
  76. android:layout_width="match_parent"
  77. android:layout_height="wrap_content"
  78. android:layout_marginTop="8dp"
  79. android:layout_marginBottom="8dp"
  80. android:inputType="none"
  81. android:imeOptions="actionDone"
  82. android:enabled="false"
  83. style="?android:attr/textViewStyle" />
Add Comment
Please, Sign In to add comment