0

RecyclerView (화면 A) 안에 있고 FrameLayout (화면 B) 안에 있지만 모두 maxLines=10입니다.안드로이드 : TextView 내부의 텍스트가 LinearLayout에서 스크롤되지만 Recyclerview에서는 스크롤되지 않는 이유

RecyclerView에서 textview는 10 줄만 렌더링하고 추가 텍스트는 무시됩니다.

그러나 LinearLayout의 textview는 10 개의 행을 표시하지만 사용자가 스크롤 할 수 있습니다.

스크롤을 해제하고 maxLines을 사용하여 최대 줄을 표시하는 방법.

  • android:isScrollContainer="false"

    가 이미 시도

    , - 그것은

  • android:enabled="false" 작동하지 않습니다 - 그것은 텍스트 뷰

업데이트에 하이퍼 링크 클릭을 비활성화합니다

RecyclerView에서 textview를 스크롤하는 것을 원하지 않습니다. LinearLayout에서만 스크롤을 비활성화하고 싶습니다.

+0

여기에 스크롤을 사용하지 않으려는 xml을 추가하십시오. – ADM

답변

1

시도해 보셨습니까?

<com.example.NoScrollTextView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:maxLines="10"/> 
1

NoScrollTextView이 같은 TextView을 확장 만들

   <TextView 
       android:id="@+id/tv" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="3dp" 
       android:maxLines="8" 
       android:text="Lorem Ipsum is simply dummy text of the dummy text of t printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy." 
       android:textSize="14sp" /> 
+0

그래, 나는 이것을 시도해 보았다. 더 좋은 접근법을 찾고있다. 단지 사용자 정의보기를 만드는 대신보기 속성을 수정하거나 설정하기 만하면된다. –

+1

붙여 넣기 같은 답변을 복사하지 마십시오 https://stackoverflow.com/questions/24027108/how-do-i-completely-prevent-a-textview-from-scrolling –

+1

나는 그것을 수정했다. –

1

가 그냥

TextView tv = (TextView) view.findViewById(R.id.tv); 
    tv.setMovementMethod(null); 

및 레이아웃 클래스에서 설정 :

public class NoScrollTextView extends TextView { 
    public NoScrollTextView(Context context) { 
     super(context); 
    } 

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

    public NoScrollTextView(Context context, AttributeSet attrs, int defStyleAttr) { 
     super(context, attrs, defStyleAttr); 
    } 

    @TargetApi(Build.VERSION_CODES.LOLLIPOP) 
    public NoScrollTextView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { 
     super(context, attrs, defStyleAttr, defStyleRes); 
    } 

    @Override 
    public void scrollTo(int x, int y) { 
     //do nothing 
    } 
} 

다음과 같이 XML이를 사용

recyclerView.setNestedScrollingEnabled(false); 
+0

downvote의 이유를 설명 해주시겠습니까? –

관련 문제