I should bring a simple swipe right task manager from the left side of'm trying to create a task manager app I screen , And a swipe task manager on the left should hide how would I accomplish this? I have two ideas, H is a B. When I want to hit the right side, see B should pop up. When I swipe h left, see b should be missing. For now, when you drown the left view B, swipe though, when you hit it properly, see B does not pop back; package wei.mark.example;
Import android.content.Intent; Import android.view.LayoutInflater; Import android.view.MotionEvent; Import android.view.View; Import android.widget.FrameLayout; Import android.widget.Toast; Import wei.mark.standout.StandOutWindow; Import wei.mark.standout.constants.StandOutFlags; Import wei.mark.standout.ui.Window; Public Square SimpleWindow StandOutWindow Expansion [see private, H, B, Tech 1; // Private Text View Tech 1; Private float x1, x2; Private int x = 300; Private int y = 1920; Fixed final integer MIN_DISTANCE = 150; @ Override public string getAppName () {return "simplevalid"; } @ Override Public Intake Icank () {Android. ArrowWabel.IC_Menu_close_clark_connect; } @Override create a new layout public void createAndAttachView (int id, FrameLayout frame) {// body.xml tex1 = frame.findViewById (R.id.textView1); B = frame.findvibiid (ridbbr); Layout Inflight Inflight = (LayoutsInflator) getSystemService (LAYOUT_INFLATER_SERVICE); Inflater.inflate (R.layout.simple, frame, true); H = frame.findviewIID (R.D. Touchwiz); h.setOnTouchListener (New OnSwipeTouchListener (this) {public void onSwipeTop () {Toast.makeText (SimpleWindow.this, "top", Toast.LENGTH_SHORT) .show ();} public void onSwipeRight () {Toast.makeText (SimpleWindow. the "right", Toast.LENGTH_SHORT) .show (); b.setVisibility (View.VISIBLE);} public void onSwipeLeft () {Toast.makeText (SimpleWindow.this, "left", Toast.LENGTH_SHORT) .show ( ); / / hide view b b.setVisibility (View.INVISIBLE);} public void onSwipeBottom () {Toast.makeText (SimpleWindow.this, "down", Toast.LENGTH_SHORT) .show ();} public boolean onTouch (see V, Motion Event Event) {Return gesture detector. Tontech Event (Event);}}); } @Override public boolean onTouchEvent (MotionEvent event) {switch (event.getAction ()) {case MotionEvent.ACTION_DOWN: x1 = event.getX (); break; Case Motion Event Action_up: x2 = event .getX (); Float delta x = x2 - x1; If (Math Box (Deltax)> MIN_DISTANCE) {Toast. Make Text (this, "left 2 right swipe", toast. LNGHHRART). Show (); } And {// thoughts something else - for example a screen tape} break; } Return super. Tonentange (event); } // Window @Override will be centered to getParams (integer ID, window window) public StandOutLayoutParams {New StandOutLayoutParams return (ID, X, Y, StandOutLayoutParams.LEFT, StandOutLayoutParams.CENTER); } // View @ Override Public int getFlags (int id) {return super.getFlags (id) drag and move the window. Standout Flags FLAG_WINDOW_FOCUSABLE_DISABLE | StandOutFlags.FL; } @ Override Public String Received Sender Message (Int ID) {Return "Click to close the simple window"; } @ Override Public Intent Milpercentent Notification Intent (Int ID) {Return Standout Windows. GtaCollinant (This, Simple Windows, Class, ID); Maybe, because the B scene is still on the layout, but you can not see it, you should use View.GONE instead of View.INVISIBLE. See. GONE This view is invisible, and it does not take any space for layout purposes. See. INVISIBLE This view is invisible, but it still takes place for layout purposes.
No comments:
Post a Comment