SwipeLayout is not working properly on AllView devices..
See original GitHub issueHi, I had made an application and I am having a bug and also tested your demo with:
Device: ALLVIEW X2_Soul Android version: 4.4.2
Device: ALLVIEW V1_VIPER_I Android version: 4.4.2
And the problem is when I tap or swipe the item row, the items that are in the background (comes from the right side of the screen) and the items that are in the foreground(they go to the left side of the screen) are not staying there, they go back instantly, like its remaking the whole row, or listview…
A part of my code how is used in the getView()
LayoutInflater inflater = LayoutInflater.from(parent.getContext()); if (convertView == null) { convertView = inflater.inflate(R.layout.list_item_command, parent, false); }
final SwipeLayout swipeLayout = ViewHolder.get(convertView, R.id.list_item_command_swipe);
swipeLayout.setShowMode(SwipeLayout.ShowMode.PullOut);
swipeLayout.setClickable(true);
swipeLayout.setClickToClose(true);
LinearLayout fgLinear = ViewHolder.get(convertView, R.id.list_item_command_fg_linear);
ImageView addProduct = ViewHolder.get(convertView, R.id.list_item_order_add_img);
ImageView removeProduct = ViewHolder.get(convertView, R.id.list_item_order_remove_img);
ImageView eraseProduct = ViewHolder.get(convertView, R.id.list_item_order_erase_img);
fgLinear.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
swipeLayout.open(true);
}
});
How it is in the list item xml:
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/command_list_item_container" android:layout_width="match_parent" android:layout_height="match_parent" android:padding="@dimen/list_item_rest_container_padding">
<com.daimajia.swipe.SwipeLayout
android:id="@+id/list_item_command_swipe"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!--BACKGROUND LAYOUT-->
<LinearLayout
android:id="@+id/bottom_wrapper"
android:layout_width="wrap_content"
android:layout_height="match_parent">
<ImageView
android:id="@+id/list_item_order_add_img"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginLeft="@dimen/list_item_command_count_margin_right"
android:layout_marginRight="@dimen/list_item_command_general_margin_right"
android:adjustViewBounds="true"
android:contentDescription="@string/content_description"
android:src="@drawable/selector_add_more_product_btn" />
<ImageView
android:id="@+id/list_item_order_remove_img"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginRight="@dimen/list_item_command_general_margin_right"
android:adjustViewBounds="true"
android:contentDescription="@string/content_description"
android:src="@drawable/selector_less_product_btn" />
<ImageView
android:id="@+id/list_item_order_erase_img"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginRight="@dimen/list_item_command_general_margin_right"
android:adjustViewBounds="true"
android:contentDescription="@string/content_description"
android:src="@drawable/selector_remove_product_btn" />
</LinearLayout>
<!--FOREGROUND LAYOUT-->
<LinearLayout
android:id="@+id/list_item_command_fg_linear"
android:layout_width="match_parent"
android:layout_height="40dp"
android:gravity="center_vertical"
android:orientation="horizontal"
android:weightSum="10">
<TextView
android:id="@+id/list_item_order_product_name_tv"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/list_item_command_general_margin_right"
android:layout_weight="5"
android:ellipsize="end"
android:singleLine="false"
android:textColor="@color/white"
android:textSize="@dimen/list_item_command_product_price_tv_size" />
<TextView
android:id="@+id/list_item_order_product_qunatity_et"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:gravity="left"
android:textColor="@color/white"
android:textSize="@dimen/list_item_command_product_price_tv_size" />
<TextView
android:id="@+id/list_item_order_price_tv"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:gravity="right"
android:textColor="@color/white"
android:textSize="@dimen/list_item_command_product_price_tv_size"
android:textStyle="bold" />
<ImageView
android:id="@+id/list_item_order_dot_menu_IV"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:src="@drawable/ic_three_dots_menu_white"
android:visibility="gone" />
</LinearLayout>
</com.daimajia.swipe.SwipeLayout>
</RelativeLayout>
Issue Analytics
- State:
- Created 8 years ago
- Comments:14
Top GitHub Comments
@haoshili Yes, The suggested line should be commented just on KitKat android like this:
if (Build.VERSION.SDK_INT != Build.VERSION_CODES.KITKAT) safeBottomView();
This solve my problem!@smhmh work like a clockwork)