是否可以在EditText中滚动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>
Run Code Online (Sandbox Code Playgroud)
或者是否可以在纵向模式下将EditText嵌入键盘?像WhatsApp这样的东西,EditText是可滚动的.
Ams*_*eer 39
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;
}
});
Run Code Online (Sandbox Code Playgroud)
并在您的xml文件中
<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>
Run Code Online (Sandbox Code Playgroud)
我希望它能帮到你..
| 归档时间: |
|
| 查看次数: |
8745 次 |
| 最近记录: |