我使用AndroidSwipeLayout圖書館從「daimajia」 Android Swipe Layout問題 - BackView刷卡更從右側
它的正常工作雖然以上版本4.4 Kitkat。輕掃佈局的backview是滑動更從右側..
PLZ參考附件圖像既爲低於4.4 KitKat及以上版本
的Android滑動佈局完美工作爲Android版4.2(傑利貝恩)下面奇巧
Android的滑動佈局 - backview右滑動更多的Android版本。 4.4(KitKat)以上
我使用AndroidSwipeLayout圖書館從「daimajia」 Android Swipe Layout問題 - BackView刷卡更從右側
它的正常工作雖然以上版本4.4 Kitkat。輕掃佈局的backview是滑動更從右側..
PLZ參考附件圖像既爲低於4.4 KitKat及以上版本
的Android滑動佈局完美工作爲Android版4.2(傑利貝恩)下面奇巧
Android的滑動佈局 - backview右滑動更多的Android版本。 4.4(KitKat)以上
我解決這個問題...
這是我swipelayout
<?xml version="1.0" encoding="utf-8" ?>
<com.synsoft.foodjini.swipelib.SwipeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:swipe="http://schemas.android.com/tools"
android:id="@+id/swipe"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
swipe:leftEdgeSwipeOffset="0dp"
swipe:rightEdgeSwipeOffset="0dp"
swipe:show_mode="lay_down"
android:background="@color/colorPrimary">
<LinearLayout
android:id="@+id/cart.item.back"
android:layout_width="600px"
android:layout_height="match_parent"
android:background="@color/colorPrimary"
android:orientation="horizontal"
android:gravity="center"
android:tag="Bottom3"
android:weightSum="10"
android:paddingLeft="6dp"
android:paddingRight="6dp"
android:paddingTop="12dp"
android:paddingBottom="12dp">
<ImageView
android:id="@+id/edit"
android:layout_width="120dp"
android:layout_height="match_parent"
android:scaleType="centerInside"
android:layout_gravity="center"
android:src="@drawable/cart_main_item_edit_ico"/>
<ImageView
android:id="@+id/delete"
android:layout_width="120dp"
android:scaleType="centerInside"
android:layout_gravity="center"
android:layout_height="match_parent"
android:src="@drawable/cart_main_item_delete_ico"/>
</LinearLayout>
<RelativeLayout
android:id="@+id/cart.item.front"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingLeft="6dp"
android:paddingRight="6dp"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:background="@android:color/white">
<TextView
android:id="@+id/quantities"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2"
android:textSize="18sp"
android:textStyle="normal"/>
<TextView
android:id="@+id/cart.item.names"
android:layout_width="220dp"
android:layout_height="wrap_content"
android:text="X Item Name Lorem Ipsum"
android:layout_marginLeft="12dp"
android:ellipsize="end"
android:singleLine="true"
android:textAllCaps="true"
android:layout_toRightOf="@+id/quantities"
android:textSize="18sp"
android:textStyle="normal"/>
<TextView
android:id="@+id/cart.item.portions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="small"
android:layout_toRightOf="@+id/cart.item.names"
android:layout_alignBottom="@+id/cart.item.names"
android:textSize="13sp"
android:textAllCaps="true"
android:textStyle="normal"/>
<TextView
android:id="@+id/cart.item.prices"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="20.00"
android:layout_alignParentRight="true"
android:drawableLeft="@drawable/cart_item_rupee_ico"
android:drawablePadding="6dp"
android:layout_alignBottom="@+id/cart.item.names"
android:textSize="16sp"
android:textStyle="normal"/>
<ImageView
android:id="@+id/cart.item.divider1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/cart_main_item_sap"
android:layout_marginTop="12dp"
android:layout_below="@+id/cart.item.names"
android:layout_alignLeft="@+id/cart.item.names"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_below="@+id/cart.item.divider1"
android:id="@+id/cart.item.addons.tag"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp">
</LinearLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/cart_main_item_sap"
android:layout_marginTop="6dp"
android:layout_below="@+id/cart.item.addons.tag"
android:layout_alignLeft="@+id/cart.item.names"/>
</RelativeLayout>
什麼我」 XML已完成匹配SwipeLayout的背景(parentlayout)和後視圖(swipeview) 機器人:背景=「@顏色/ colorPrimary」 ..,使得如果backview 定位比視圖不當並不顯得那麼不對稱
另外改變show_mode SwipeLayout的lay_down 和frontview的白色背景
因此,這可以跳過在kitkat和更高版本上發現的問題。
雖然它不是妥善解決。在未來,我要學習的lib,並試圖找到爲什麼定位是不適當的奇巧上述N
我做了一些研究,並找到拖動距離有問題。現在我已經想出瞭解決方法。這會導致動畫奇怪的跳躍,但最終backview會轉到正確的位置。我會盡力找到更好的解決方案。
在課堂上 「SwipeLayout」 我們需要修改 「開放」 的方法:
public void open(boolean smooth, boolean notify) {
View surface = getSurfaceView(), bottom = getCurrentBottomView();
if (surface == null) {
return;
}
int dx, dy;
Rect rect = computeSurfaceLayoutArea(true);
// if (smooth) {
// mDragHelper.smoothSlideViewTo(surface, rect.left, rect.top);
// } else {
dx = rect.left - surface.getLeft();
dy = rect.top - surface.getTop();
surface.layout(rect.left, rect.top, rect.right, rect.bottom);
if (getShowMode() == ShowMode.PullOut) {
Rect bRect = computeBottomLayoutAreaViaSurface(ShowMode.PullOut, rect);
if (bottom != null) {
bottom.layout(bRect.left, bRect.top, bRect.right, bRect.bottom);
}
}
if (notify) {
dispatchRevealEvent(rect.left, rect.top, rect.right, rect.bottom);
dispatchSwipeEvent(rect.left, rect.top, dx, dy);
} else {
safeBottomView();
}
// }
invalidate();
}
我真的很感謝你的努力:-) ....我會等待你的更好的解決方案..雖然這有助於..但一段時間它的定位是不恰當的什麼是真正的問題是..它保持不變 –
不幸的是我現在很忙,所以我不會很快在這個庫上工作。也許你想檢查這個庫: https://github.com/baoyongzhang/SwipeMenuListView 這個刷卡有點難以使用,你必須在代碼中定義你的刷卡按鈕,但它的工作原理:) – MartinR
我已經在最初使用這個庫..在這發現的問題是後視限制,我們不允許我們的佈局附加到後視圖(刷卡菜單)。你只允許創建使用SwipeMenuCreator與有限的選項....我也嘗試自定義SwipeMenuCreator或其他Java類acc按我的需要..允許附加布局後視圖(刷卡菜單)..但整體發現問題...找到更好的解決方案是切換到其他庫或我們自己的方法... –
什麼是你的問題?我想你應該在他的回購中創建一個問題。 –
yes ... for ver。 4.4和以上的backview定位是不正確的... –
這是一個開源的庫,所以如果它不能按照你想要的方式工作,你可以閱讀代碼,然後根據需要進行修改,編程不僅僅是獲取一堆庫在一起... – 2Dee