मेरे फोन पर, बदलते imeOptions और inputType कुछ नहीं करता है; आंदोलन सेटिंग विधि और/या scrollBarStyle घटक को इतनी बुरी तरह खराब कर देगा ताकि उपयोगकर्ता कोई भी टेक्स्ट चुनने में असमर्थ रहे; isVerticalScrollBarEnabled और isHorizontalScrollBarEnabled कुछ भी नहीं करता है; सबसे अच्छा मैं कर सकता का उपयोग करने के
txt.setSingleLine(false);
(txt.setImeOptions(EditorInfo.IME_FLAG_NO_ENTER_ACTION);
अनावश्यक प्रतीत हो रहा है) लेकिन यह है कि भगवान-लानत EditText में किसी भी स्क्रॉलबार प्रदर्शित नहीं होगा है। आखिर में मैंने छोड़ दिया और जब भी मुझे एक बहु-रेखा संपादन टेक्स्ट की आवश्यकता होती है तो मैं एक लेआउट स्निपेट फुला रहा हूं। यहाँ लेआउट है:
<?xml version="1.0" encoding="utf-8"?>
<EditText xmlns:android="http://schemas.android.com/apk/res/android"
android:inputType="textMultiLine"
android:lines="4"
android:minLines="4"
android:gravity="top|start"
android:maxLines="4"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:scrollbars="vertical"
/>
और यहाँ Anko टुकड़ा है:
fun ViewManager.multiLineEditText(@StyleRes theme: Int = 0, init: EditText.() -> Unit): EditText = ankoView(
{ ctx -> ctx.layoutInflater.inflate(R.layout.util_multilineedittext, [email protected] as ViewGroup, false) as EditText }, theme, init)
विकास Android पर इतनी मेहनत बेकार है।
स्रोत
2017-04-19 09:50:39
हां महोदय। आपको यह मिला! यह बहुत अच्छा काम करता है। ग्रेसियस। – Ton
यदि setEms (int) कहा जाता है, तो यह काम नहीं करता है। –