1
我正在我的Android項目之一,我在Listview行中顯示一個ListView與Edittext。問題是當我嘗試滾動Edittext時,我不能這樣做,因爲Listview會滾動。我如何在Listview中實現可滾動的Edittext。可滾動的Edittext在Android的列表視圖
這裏是我的列表視圖適配器代碼
@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;
}
這是我EDITTEXT xml文件中
<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" />
讓我試試這個。將接受這個答案,如果它工作正常 –