2016-07-14 7 views
0

텍스트보기와 그 롤링을 미리 롤리팝 버전에서 부드럽게 수행 할 수 있습니다. 하지만 롤리팝 버전 이상에서는 작동하지 않습니다. 이것 좀 도와주세요.Textview 롤리팝 버전에서 움직이지 않는 움직이는 문자

다음은 XML 코드입니다. 수직 대 수평

<TextView 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:textAppearance="?android:attr/textAppearanceLarge" 
    android:id="@+id/textView1" 
    android:layout_gravity="center_horizontal" 
    android:ellipsize="marquee" 
    android:singleLine="true" 
    android:layout_marginTop="-12dp" 
    android:marqueeRepeatLimit="marquee_forever" 
    android:scrollHorizontally="true" 
    android:textColor="@color/white" 
    android:background="#00AEEF" 
    android:focusable="true" 
    android:focusableInTouchMode="true" 
    android:fadingEdge="horizontal" 
    android:freezesText="true" 
    /> 
+0

는 "txtView.setSelected을 추가 한 사실 사용하는 텍스트 뷰 확장); " 당신의 코드에서? –

+0

@sunilsunny : 예. 전 롤리팝 버전에서는 텍스트 선택 윤곽이 추가되었지만 롤리팝 이상에서는 허용되지 않습니다.하지만 감사합니다. – theP

답변

0

을 다음과 같이

시도하는 것은 다음 isFocus를 오버라이드 (override)()

public class MyTextView extends TextView { 

public MyTextView(Context context, AttributeSet attrs) { 
    super(context, attrs); 
} 

protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) { 
    if (focused) 
     super.onFocusChanged(focused, direction, previouslyFocusedRect); 
} 

@Override 
public void onWindowFocusChanged(boolean focused) { 
    if (focused) 
     super.onWindowFocusChanged(focused); 
} 

@Override 
public boolean isFocused() { 
    //always focus 
    return true; 
} 
} 

다음 (

<common.widget.MyTextView 
    android:id="@+id/tv_autoplay" 
    android:background="#CDC9C4" 
    android:singleLine="true" 
    android:ellipsize="marquee" 
    android:focusableInTouchMode="true" 
    android:focusable="true" 
    android:marqueeRepeatLimit="marquee_forever" 
    android:scrollHorizontally="true" 
    android:textColor="#fff" 
    android:gravity="center" 
    android:text="marqueemarqueemarqueemarqueemarqueemarquee……………………" 
    android:layout_width="match_parent" 
    android:layout_height="30dp" /> 
+0

내 코드를 urs 코드로 바꿨지 만 내 텍스트를 스크롤하지는 않았다. 내 텍스트는 데이터베이스와 textview에서 온다. 텍스트 스크롤 .. 제발 도와주세요 – theP

+0

@theP https://github.com/microjixl/marquee_text – Cgx

+0

나는 ur 링크를 사용 .. 그리고 그것을 위해 덕분에 작동합니다. 하지만 한 줄을 3 번 보여주고 그 두 번째 줄을 3 번하고 모두 ..하지만 첫줄을 보여주고 싶습니다. 1 번과 다음 줄을 다시 보여줍니다. 두 번째 줄 .. – theP

0

scrollbars = "horizontal", scrollbars = "vertical". MyTextView를 만드는 코드를

android:maxLines = "AN_INTEGER" 
android:scrollbars = "horizontal" 
+0

고마워요. 나는 시도 할 것이다. – theP

+0

나는 ur 코드를 시도했지만 행운이 없다. ..please help – theP

관련 문제