Scrollable Edittext in Listview in android

392 views Asked by At

I am working on one of my Android project in which I am showing one Listview with Edittext inside Listview row. the problem is when I try to scroll Edittext, I can not do so as Listview will be scroll. How can I achieve scrollable Edittext in Listview.

Here is my code for Listview adapter

@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    MyViewHolder mViewHolder;

    if(convertView == null) {
        convertView = inflater.inflate(R.layout.custom_deal_supplier, null);
        mViewHolder = new MyViewHolder();
        convertView.setTag(mViewHolder);
    } else {
        mViewHolder = (MyViewHolder) convertView.getTag();
    }

    mViewHolder.tvConsumerName = detail(convertView, R.id.txt_consumer_name, dealDoneListHere.get(position).getConsumerName());// Set consumer name here
    mViewHolder.edtShippingAddress=(EditText)convertView.findViewById(R.id.edt_details_shipping_address);
    mViewHolder.edtShippingAddress.setVisibility(View.VISIBLE);

// contains more than 500 characters
mViewHolder.edtShippingAddress.setText(dealDoneListHere.get(position).getShippingAddress()+"");

    return convertView;
}

Here is my Edittext in xml file

<com.hlink.supplementwar.view.CustomEditView
            android:id="@+id/edt_details_shipping_address"
            android:layout_width="match_parent"
            android:layout_height="@dimen/dp_60_shipping"
            android:layout_margin="@dimen/dp_5"
            android:background="@drawable/deal_done_desciption"
            android:enabled="true"
            android:maxLength="500"
            android:paddingBottom="@dimen/dp_5"
            android:paddingLeft="@dimen/dp_5"
            android:paddingRight="@dimen/dp_5"
            android:scrollbars="vertical"
            android:textColor="@color/edit_text_color"
            android:textSize="@dimen/sp_13"
            android:visibility="gone"
            app:fontName="fonts/Roboto_Light.ttf" />
1

There are 1 answers

0
Moinkhan On BEST ANSWER

You shold may try this ...

mViewHolder.edtShippingAddress.setOnTouchListener(new OnTouchListener() {
    // Setting on Touch Listener for handling the touch inside ScrollView
    @Override
    public boolean onTouch(View v, MotionEvent event) {
    // Disallow the touch request for parent scroll on touch of child view
    v.getParent().requestDisallowInterceptTouchEvent(true);
    return false;
    }
});