/ / Android में स्क्रॉलिंग टेक्स्टव्यू स्क्रॉल नहीं कर रहा है। - एंड्रॉयड, टेक्स्टव्यू

एंड्रॉइड में स्क्रॉलिंग टेक्स्टव्यू स्क्रॉल नहीं कर रहा है। - एंड्रॉइड, टेक्स्टव्यू

मैं अपने पाठ को पोस्ट के रूप में स्क्रॉल कर रहा हूं यहाँ.

मुझे लगता है कि मैंने देखा कि यह पहली बार किसी अन्य जावा कोड में भी बिना किसी जावा कोड के स्क्रॉल कर रहा था। लेकिन अब, यह कोई स्क्रॉल नहीं है। कोई विचार नहीं है कि इसके साथ क्या गलत है।

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="?attr/actionBarSize">

<LinearLayout
android:id="@+id/scrollingTextLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#0792B5"
android:gravity="center_vertical"
android:orientation="horizontal">

<TextView
android:id="@+id/scrollingText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
android:maxLines="1"
android:padding="5dp"
android:scrollHorizontally="true"
android:text="The culture of India is the way of living of people of India."
android:textColor="#FFFFFF"
android:textSize="16sp" />

</LinearLayout>

<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/scrollingTextLayout"
android:background="@android:color/darker_gray" />

</RelativeLayout>

उत्तर:

उत्तर № 1 के लिए 1

बस इन लाइनों को अपने xml में डालें:

android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:singleLine="true"
android:scrollHorizontally="true"

और आपके कोड में:

textView.setSelected(true);

उत्तर № 2 के लिए 1

यह अब स्क्रॉल कर रहा है। मैंने अभी-अभी बदला है maxLines="1" सेवा मेरे singleLine="true" , तुम्हें पता है यह थोड़ा अजीब है। मैं बदल गया singleLine सेवा मेरे maxLines क्योंकि IDE ने मुझे उपयोग करने का सुझाव दिया था maxLines के बजाय singleLine चूंकि यह पहले से ही अपदस्थ है।


जवाब के लिए 0 № 3

इस कोड को गतिविधि में जोड़ें

TexView tv=findViewbyId(R.id.scrollingText);
tv.setSelected(true);