I searched all posts regarding to this subject but still I could not find any solution. I have one big layout and it is scrollable with ScrollView and it has also EditText with scrollable . If I try to scroll edittext , layout is starting to scrolling. How I can solve it?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ScrollView
android:id="@+id/lroot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fillViewport="true"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/img6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:gravity="right"
android:onClick="runInfo"
android:src="@drawable/info_btn" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/splash" />
<!-- Scrollable EditText -->
<EditText
android:id="@+id/EditText01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:autoLink="all"
android:background="@drawable/isim_soyisim"
android:clickable="true"
android:cursorVisible="true"
android:gravity="left|top"
android:scrollbars="vertical"
android:inputType="textMultiLine"
android:longClickable="false"
android:maxLines="5"
android:singleLine="false"
/>
</LinearLayout>
</ScrollView>
</LinearLayout>
Try this Solution
Ref link
EditText EtOne = (EditText) findViewById(R.id.EditText01);
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;
}
});
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