I have searched for the solution but it seems those are not working. Is it my case not applicable for changing the xml? How to fix the problem ? The scroll view work but the edittext not working. Thanks
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/share_bg" >
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:layout_marginTop="20dp"
android:overScrollMode="never" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/photo_area"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/share_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/photo_area"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:text="@string/share_title"
android:textColor="@android:color/white" />
<EditText
android:id="@+id/share_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/share_title"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:background="@drawable/custom_textarea"
android:gravity="top|left"
android:lines="5"
android:scrollbars="vertical"
android:text="@string/default_msg" >
<requestFocus />
</EditText>
<ImageView
android:id="@+id/share_submit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/share_content"
android:layout_centerHorizontal="true"
android:src="@drawable/photo_taken_btn_submit" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>
The id: share_content is the editText, Thanks
You can perform this to make an edittext scrollable:
EditText EtOne = (EditText) findViewById(R.id.comment1);
EtOne.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (v.getId() == R.id.comment1) {
v.getParent().requestDisallowInterceptTouchEvent(true);
switch (event.getAction() & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_UP:
v.getParent().requestDisallowInterceptTouchEvent(false);
break;
}
}
return false;
}
});
See "Scrolling editbox inside scrollview"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With