Open xuzhenyang opened 8 years ago
I set drag edge as Top and work successful, but it can still drag to the left , can anyone help me? thx~
<com.daimajia.swipe.SwipeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/sample1" android:layout_width="match_parent" android:layout_height="80dp"> <!-- Bottom View Start--> <LinearLayout android:id="@+id/bottom_wrapper" android:layout_width="160dp" android:layout_height="match_parent" android:background="#9affcc" > <!--What you want to show--> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="诗;韵文;诗一样的作品;富有诗意的东西;" /> </LinearLayout> <!-- Bottom View End--> <!-- Surface View Start --> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="#ffffff" android:padding="10dp"> <!--What you want to show in SurfaceView--> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Poem" /> </LinearLayout> <!-- Surface View End --> </com.daimajia.swipe.SwipeLayout>
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_test); SwipeLayout swipeLayout = (SwipeLayout) findViewById(R.id.sample1); //set show mode. swipeLayout.setShowMode(SwipeLayout.ShowMode.LayDown); //add drag edge.(If the BottomView has 'layout_gravity' attribute, this line is unnecessary) swipeLayout.addDrag(SwipeLayout.DragEdge.Top, findViewById(R.id.bottom_wrapper)); swipeLayout.addSwipeListener(new SwipeLayout.SwipeListener() { @Override public void onClose(SwipeLayout layout) { //when the SurfaceView totally cover the BottomView. } @Override public void onUpdate(SwipeLayout layout, int leftOffset, int topOffset) { //you are swiping. } @Override public void onStartOpen(SwipeLayout layout) { } @Override public void onOpen(SwipeLayout layout) { //when the BottomView totally show. } @Override public void onStartClose(SwipeLayout layout) { } @Override public void onHandRelease(SwipeLayout layout, float xvel, float yvel) { //when user's hand released. } }); }
Set below property.
swipeLayout.setLeftSwipeEnabled(false);
Thx very much~ : )
I set drag edge as Top and work successful, but it can still drag to the left , can anyone help me? thx~
XML
TestActivity.java