滚动里面一个EditText其的滚动 [英] Scroll inside an EditText which is in a ScrollView
本文介绍了滚动里面一个EditText其的滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以滚动一个EditText这是在滚动型
?
<滚动型
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT>
<的LinearLayout
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:方向=垂直>
<! - 滚动这里面的EditText - >
< EditText上机器人:ID =@ + ID / et_scrollhere
机器人:行=6
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:提示=Voorbeeld
机器人:layout_margin =5DP
机器人:滚动条=垂直
机器人:inputType =textMultiLine/>
< / LinearLayout中>
< /滚动型>
还是有可能有嵌在键盘在纵向模式中的EditText?像WhatsApp的,那是的EditText滚动。
解决方案
的EditText dwEdit =(EditText上)findViewById(R.id.DwEdit);
dwEdit.setOnTouchListener(新OnTouchListener(){
公共布尔onTouch(查看视图,MotionEvent事件){
// TODO自动生成方法存根
如果(view.getId()== R.id.DwEdit){
。view.getParent()requestDisallowInterceptTouchEvent(真正的);
开关(event.getAction()及MotionEvent.ACTION_MASK){
案例MotionEvent.ACTION_UP:
。view.getParent()requestDisallowInterceptTouchEvent(假);
打破;
}
}
返回false;
}
});
而在你的xml文件
<的EditText
机器人:ID =@ + ID / DwEdit
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
安卓的minlines =10
机器人:scrollbarStyle =insideInset
机器人:滚动条=垂直
机器人:overScrollMode =总是
机器人:inputType =textCapSentences>
< /的EditText>
我希望这会帮助你。
Is it possible to scroll inside an EditText which is in a ScrollView
?
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- scroll inside this EditText -->
<EditText android:id="@+id/et_scrollhere"
android:lines="6"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="Voorbeeld"
android:layout_margin="5dp"
android:scrollbars="vertical"
android:inputType="textMultiLine"/>
</LinearLayout>
</ScrollView>
Or is it possible to have the EditText embedded in the keyboard in portrait mode? Something like WhatsApp, that EditText is scrollable.
解决方案
EditText dwEdit = (EditText) findViewById(R.id.DwEdit);
dwEdit.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View view, MotionEvent event) {
// TODO Auto-generated method stub
if (view.getId() ==R.id.DwEdit) {
view.getParent().requestDisallowInterceptTouchEvent(true);
switch (event.getAction()&MotionEvent.ACTION_MASK){
case MotionEvent.ACTION_UP:
view.getParent().requestDisallowInterceptTouchEvent(false);
break;
}
}
return false;
}
});
And in your xml file
<EditText
android:id="@+id/DwEdit"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:minLines="10"
android:scrollbarStyle="insideInset"
android:scrollbars="vertical"
android:overScrollMode="always"
android:inputType="textCapSentences">
</EditText>
I hope it will help you ..
这篇关于滚动里面一个EditText其的滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文