我正在尝试使用此代码
使edittext可滚动 <EditText
android:id="@+id/details"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="@drawable/roundededitetxt"
android:gravity="center"
android:hint="@string/txtdetails"
android:overScrollMode="always"
android:enabled="true"
android:focusableInTouchMode="true"
android:scrollbarStyle="insideInset"
android:scrollbars="vertical"
android:editable="true"
android:clickable="true"
android:fadeScrollbars="false" />
和java
details.setScroller(new Scroller(getActivity()));
details.setMaxLines(2);
details.setVerticalScrollBarEnabled(true);
details.setVerticalFadingEdgeEnabled(false);
details.setMovementMethod(new ScrollingMovementMethod());
details.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
v.getParent().requestDisallowInterceptTouchEvent(true);
switch (event.getAction() & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_UP:
v.getParent().requestDisallowInterceptTouchEvent(false);
return true;
}
return false;
}
});
edittext滚动正常,但我不能再输入它了,滚动条也没有显示但我可以滚动文本
答案 0 :(得分:0)