na moim telefonie, zmiana imeOptions i InputType nic nie robi; ustawienie moveMethod i/lub scrollBarStyle tak mocno skręci komponent, że użytkownik nie będzie w stanie wybrać żadnego tekstu; isVerticalScrollBarEnabled i isHorizontalScrollBarEnabled nic nie robi; najlepsze co mogłem zrobić, to użyć
txt.setSingleLine(false);
(txt.setImeOptions(EditorInfo.IME_FLAG_NO_ENTER_ACTION);
wydaje się być niepotrzebne), ale że nie będą wyświetlane żadne paski przewijania w EditText boga-cholera. Ostatecznie zrezygnowałem i nadmuchuję fragment kodu w dowolnym momencie, kiedy potrzebuję wielowierszowego EditText. Oto układ:
<?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"
/>
A oto fragment 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)
Development na Androida ssie tak mocno.
Tak, proszę pana. Masz to! Działa świetnie. Gracias. – Ton
jeśli setEms (int) jest wywoływana, to nie działa. –