最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android實現(xiàn)上下菜單雙向滑動效果

 更新時間:2018年01月24日 11:56:13   作者:hahashui123  
這篇文章主要為大家詳細介紹了Android實現(xiàn)上下菜單雙向滑動效果,具有一定的參考價值,感興趣的小伙伴們可以參考一下

這是研究了網(wǎng)上大神雙向左右滑動后實現(xiàn)的上下雙向滑動特效,有興趣的朋友可以看下面代碼,注釋很詳細,原理就是根據(jù)手指滑動的方向,來將上下兩個布局進行顯示與隱藏。主要用了onTouch方法,獲取滑動的距離進行偏移。

import android.content.Context; 
import android.os.AsyncTask; 
import android.util.AttributeSet; 
import android.view.MotionEvent; 
import android.view.VelocityTracker; 
import android.view.View; 
import android.view.ViewConfiguration; 
import android.view.WindowManager; 
import android.view.View.OnTouchListener; 
import android.widget.RelativeLayout; 
 
public class UpAndDownSlidinglayout extends RelativeLayout implements OnTouchListener{ 
  /** 
   * 滾動顯示和隱藏上側(cè)布局時,手指滑動需要達到的速度。 
   */ 
  public static final int SNAP_VELOCITY = 200; 
 
  /** 
   * 滑動狀態(tài)的一種,表示未進行任何滑動。 
   */ 
  public static final int DO_NOTHING = 0; 
  /** 
   * 滑動狀態(tài)的一種,表示正在滑出上側(cè)菜單。 
   */ 
  public static final int SHOW_UP_MENU = 1; 
 
  /** 
   * 滑動狀態(tài)的一種,表示正在滑出下側(cè)菜單。 
   */ 
  public static final int SHOW_DOWN_MENU = 2; 
 
  /** 
   * 滑動狀態(tài)的一種,表示正在隱藏上側(cè)菜單。 
   */ 
  public static final int HIDE_UP_MENU = 3; 
 
  /** 
   * 滑動狀態(tài)的一種,表示正在隱藏下側(cè)菜單。 
   */ 
  public static final int HIDE_DOWN_MENU = 4; 
 
  /** 
   * 記錄當前的滑動狀態(tài) 
   */ 
  private int slideState; 
 
  /** 
   * 屏幕寬度值。 
   */ 
  private int screenWidth; 
  private int screenHeight; 
 
  /** 
   * 在被判定為滾動之前用戶手指可以移動的最大值。 
   */ 
  private int touchSlop; 
 
  /** 
   * 記錄手指按下時的橫坐標。 
   */ 
  private float xDown; 
 
  /** 
   * 記錄手指按下時的縱坐標。 
   */ 
  private float yDown; 
 
  /** 
   * 記錄手指移動時的橫坐標。 
   */ 
  private float xMove; 
 
  /** 
   * 記錄手指移動時的縱坐標。 
   */ 
  private float yMove; 
 
  /** 
   * 記錄手機抬起時的縱坐標。 
   */ 
  private float yUp; 
  /** 
   * 上側(cè)菜單當前是顯示還是隱藏。只有完全顯示或隱藏時才會更改此值,滑動過程中此值無效。 
   */ 
  private boolean isUpMenuVisible; 
 
  /** 
   * 下側(cè)菜單當前是顯示還是隱藏。只有完全顯示或隱藏時才會更改此值,滑動過程中此值無效。 
   */ 
  private boolean isDownMenuVisible; 
 
  /** 
   * 是否正在滑動。 
   */ 
  private boolean isSliding; 
 
  /** 
   * 上側(cè)菜單布局對象。 
   */ 
  private View upMenuLayout; 
 
  /** 
   * 下側(cè)菜單布局對象。 
   */ 
  private View downMenuLayout; 
 
  /** 
   * 內(nèi)容布局對象。 
   */ 
  private View contentLayout; 
 
  /** 
   * 用于監(jiān)聽滑動事件的View。 
   */ 
  private View mBindView; 
 
  /** 
   * 上側(cè)菜單布局的參數(shù)。 
   */ 
  private MarginLayoutParams upMenuLayoutParams; 
 
  /** 
   * 下側(cè)菜單布局的參數(shù)。 
   */ 
  private MarginLayoutParams downMenuLayoutParams; 
 
  /** 
   * 內(nèi)容布局的參數(shù)。 
   */ 
  private RelativeLayout.LayoutParams contentLayoutParams; 
 
  /** 
   * 用于計算手指滑動的速度。 
   */ 
  private VelocityTracker mVelocityTracker; 
   
  public UpAndDownSlidinglayout(Context context, AttributeSet attrs) { 
    super(context, attrs); 
    WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); 
    screenWidth = wm.getDefaultDisplay().getWidth(); 
    screenHeight = wm.getDefaultDisplay().getHeight(); 
    touchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); 
  } 
  /** 
   * 綁定監(jiān)聽滑動事件的View。 
   * 
   * @param bindView 
   *      需要綁定的View對象。 
   */ 
  public void setScrollEvent(View bindView) { 
    mBindView = bindView; 
    mBindView.setOnTouchListener(this); 
  } 
  @Override 
  public boolean onTouch(View v, MotionEvent event) { 
    // TODO Auto-generated method stub 
    createVelocityTracker(event); 
    switch (event.getAction()) { 
    case MotionEvent.ACTION_DOWN: 
      // 手指按下時,記錄按下時的坐標 
      xDown = event.getRawX(); 
      yDown = event.getRawY(); 
      // 將滑動狀態(tài)初始化為DO_NOTHING 
      slideState = DO_NOTHING; 
      break; 
    case MotionEvent.ACTION_MOVE: 
      xMove = event.getRawX(); 
      yMove = event.getRawY(); 
      int moveDistanceX = (int) (xMove - xDown); 
      int moveDistanceY = (int) (yMove - yDown); 
      // 檢查當前的滑動狀態(tài) 
      checkSlideState(moveDistanceX, moveDistanceY); 
      switch (slideState) { 
      case SHOW_UP_MENU: 
        contentLayoutParams.bottomMargin = -moveDistanceY; 
        checkUpMenuBorder(); 
        contentLayout.setLayoutParams(contentLayoutParams); 
        break; 
      case HIDE_UP_MENU: 
        contentLayoutParams.bottomMargin = -upMenuLayoutParams.height - moveDistanceY; 
        checkUpMenuBorder(); 
        contentLayout.setLayoutParams(contentLayoutParams); 
      case SHOW_DOWN_MENU: 
        contentLayoutParams.topMargin = moveDistanceY; 
        checkDownMenuBorder(); 
        contentLayout.setLayoutParams(contentLayoutParams); 
        break; 
      case HIDE_DOWN_MENU: 
        contentLayoutParams.topMargin = -downMenuLayoutParams.height + moveDistanceY; 
        checkDownMenuBorder(); 
        contentLayout.setLayoutParams(contentLayoutParams); 
      default: 
        break; 
      } 
       
      break; 
    case MotionEvent.ACTION_UP: 
      yUp = event.getRawY(); 
      int upDistanceY = (int) (yUp - yDown); 
      if (isSliding) { 
        // 手指抬起時,進行判斷當前手勢的意圖 
        switch (slideState) { 
        case SHOW_UP_MENU: 
          if (shouldScrollToUpMenu()) { 
            scrollToUpMenu(); 
          } else { 
            scrollToContentFromUpMenu(); 
          } 
          break; 
        case HIDE_UP_MENU: 
          if (shouldScrollToContentFromUpMenu()) { 
            scrollToContentFromUpMenu(); 
          } else { 
            scrollToUpMenu(); 
          } 
          break; 
        case SHOW_DOWN_MENU: 
          if (shouldScrollToDownMenu()) { 
            scrollToDownMenu(); 
          } else { 
            scrollToContentFromDownMenu(); 
          } 
          break; 
        case HIDE_DOWN_MENU: 
          if (shouldScrollToContentFromDownMenu()) { 
            scrollToContentFromDownMenu(); 
          } else { 
            scrollToDownMenu(); 
          } 
          break; 
        default: 
          break; 
        } 
      }else if (upDistanceY < touchSlop && isUpMenuVisible) { 
        // 當上側(cè)菜單顯示時,如果用戶點擊一下內(nèi)容部分,則直接滾動到內(nèi)容界面 
        scrollToContentFromUpMenu(); 
      } else if (upDistanceY < touchSlop && isDownMenuVisible) { 
        // 當下側(cè)菜單顯示時,如果用戶點擊一下內(nèi)容部分,則直接滾動到內(nèi)容界面 
        scrollToContentFromDownMenu(); 
      } 
      recycleVelocityTracker(); 
      break; 
    } 
    return true; 
  } 
   
  /** 
   * 創(chuàng)建VelocityTracker對象,并將觸摸事件加入到VelocityTracker當中。 
   * 
   * @param event 
   *       
   */ 
  private void createVelocityTracker(MotionEvent event) { 
    if (mVelocityTracker == null) { 
      mVelocityTracker = VelocityTracker.obtain(); 
    } 
    mVelocityTracker.addMovement(event); 
  } 
   
  /** 
   * 根據(jù)手指移動的距離,判斷當前用戶的滑動意圖,然后給slideState賦值成相應的滑動狀態(tài)值。 
   * 
   * @param moveDistanceX 
   *      橫向移動的距離 
   * @param moveDistanceY 
   *      縱向移動的距離 
   */ 
  private void checkSlideState(int moveDistanceX, int moveDistanceY) { 
    if(isUpMenuVisible){ 
      if (!isSliding && Math.abs(moveDistanceY) >= touchSlop && moveDistanceY < 0) { 
        isSliding = true; 
        slideState = HIDE_UP_MENU; 
      } 
    }else if(isDownMenuVisible){ 
      if (!isSliding && Math.abs(moveDistanceY) >= touchSlop && moveDistanceY > 0) { 
        isSliding = true; 
        slideState = HIDE_DOWN_MENU; 
      } 
    }else{ 
      if (!isSliding && Math.abs(moveDistanceY) >= touchSlop && moveDistanceY > 0 
          && Math.abs(moveDistanceX) < touchSlop) { 
        isSliding = true; 
        slideState = SHOW_UP_MENU; 
        contentLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, 0); 
        contentLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); 
        contentLayout.setLayoutParams(contentLayoutParams); 
        // 如果用戶想要滑動上側(cè)菜單,將上側(cè)菜單顯示,下側(cè)菜單隱藏 
        upMenuLayout.setVisibility(View.VISIBLE); 
        downMenuLayout.setVisibility(View.GONE); 
      }else if(!isSliding && Math.abs(moveDistanceY) >= touchSlop && moveDistanceY < 0 
          && Math.abs(moveDistanceX) < touchSlop){ 
        isSliding = true; 
        slideState = SHOW_DOWN_MENU; 
        contentLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0); 
        contentLayoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP); 
        contentLayout.setLayoutParams(contentLayoutParams); 
        // 如果用戶想要滑動下側(cè)菜單,將下側(cè)菜單顯示,上側(cè)菜單隱藏 
        upMenuLayout.setVisibility(View.GONE); 
        downMenuLayout.setVisibility(View.VISIBLE); 
      } 
    } 
  } 
   
  /** 
   * 在滑動過程中檢查上側(cè)菜單的邊界值,防止綁定布局滑出屏幕。 
   */ 
  private void checkUpMenuBorder() { 
    if (contentLayoutParams.bottomMargin > 0) { 
      contentLayoutParams.bottomMargin = 0; 
    } else if (contentLayoutParams.bottomMargin < -upMenuLayoutParams.height) { 
      contentLayoutParams.bottomMargin = -upMenuLayoutParams.height; 
    } 
  } 
  /** 
   * 在滑動過程中檢查下側(cè)菜單的邊界值,防止綁定布局滑出屏幕。 
   */ 
  private void checkDownMenuBorder() { 
    if (contentLayoutParams.topMargin > 0) { 
      contentLayoutParams.topMargin = 0; 
    } else if (contentLayoutParams.topMargin < -downMenuLayoutParams.height) { 
      contentLayoutParams.topMargin = -downMenuLayoutParams.height; 
    } 
  } 
  /** 
   * 判斷是否應該滾動將上側(cè)菜單展示出來。如果手指移動距離大于上側(cè)菜單寬度的1/2,或者手指移動速度大于SNAP_VELOCITY, 
   * 就認為應該滾動將上側(cè)菜單展示出來。 
   * 
   * @return 如果應該將上側(cè)菜單展示出來返回true,否則返回false。 
   */ 
  private boolean shouldScrollToUpMenu() { 
    return yUp - yDown > upMenuLayoutParams.height / 2 || getScrollVelocity() > SNAP_VELOCITY; 
  } 
 
  /** 
   * 判斷是否應該滾動將下側(cè)菜單展示出來。如果手指移動距離大于下側(cè)菜單寬度的1/2,或者手指移動速度大于SNAP_VELOCITY, 
   * 就認為應該滾動將下側(cè)菜單展示出來。 
   * 
   * @return 如果應該將下側(cè)菜單展示出來返回true,否則返回false。 
   */ 
  private boolean shouldScrollToDownMenu() { 
    return yDown - yUp > downMenuLayoutParams.height / 2 || getScrollVelocity() > SNAP_VELOCITY; 
  } 
 
  /** 
   * 判斷是否應該從上側(cè)菜單滾動到內(nèi)容布局,如果手指移動距離大于上側(cè)菜單寬度的1/2,或者手指移動速度大于SNAP_VELOCITY, 
   * 就認為應該從上側(cè)菜單滾動到內(nèi)容布局。 
   * 
   * @return 如果應該從上側(cè)菜單滾動到內(nèi)容布局返回true,否則返回false。 
   */ 
  private boolean shouldScrollToContentFromUpMenu() { 
    return yDown - yUp > upMenuLayoutParams.height / 2 || getScrollVelocity() > SNAP_VELOCITY; 
  } 
 
  /** 
   * 判斷是否應該從下側(cè)菜單滾動到內(nèi)容布局,如果手指移動距離大于下側(cè)菜單寬度的1/2,或者手指移動速度大于SNAP_VELOCITY, 
   * 就認為應該從下側(cè)菜單滾動到內(nèi)容布局。 
   * 
   * @return 如果應該從下側(cè)菜單滾動到內(nèi)容布局返回true,否則返回false。 
   */ 
  private boolean shouldScrollToContentFromDownMenu() { 
    return yUp - yDown > downMenuLayoutParams.height / 2 || getScrollVelocity() > SNAP_VELOCITY; 
  } 
  /** 
   * 獲取手指在綁定布局上的滑動速度。 
   * 
   * @return 滑動速度,以每秒鐘移動了多少像素值為單位。 
   */ 
  private int getScrollVelocity() { 
    mVelocityTracker.computeCurrentVelocity(1000); 
    int velocity = (int) mVelocityTracker.getXVelocity(); 
    return Math.abs(velocity); 
  } 
   
  class UpMenuScrollTask extends AsyncTask<Integer, Integer, Integer> { 
 
    @Override 
    protected Integer doInBackground(Integer... speed) { 
      int bottomMargin = contentLayoutParams.bottomMargin; 
      // 根據(jù)傳入的速度來滾動界面,當滾動到達邊界值時,跳出循環(huán)。 
      while (true) { 
        bottomMargin = bottomMargin + speed[0]; 
        if (bottomMargin < -upMenuLayoutParams.height) { 
          bottomMargin = -upMenuLayoutParams.height; 
          break; 
        } 
        if (bottomMargin > 0) { 
          bottomMargin = 0; 
          break; 
        } 
        publishProgress(bottomMargin); 
        // 為了要有滾動效果產(chǎn)生,每次循環(huán)使線程睡眠一段時間,這樣肉眼才能夠看到滾動動畫。 
        sleep(15); 
      } 
      if (speed[0] > 0) { 
        isUpMenuVisible = false; 
      } else { 
        isUpMenuVisible = true; 
      } 
      isSliding = false; 
      return bottomMargin; 
    } 
 
    @Override 
    protected void onProgressUpdate(Integer... bottomMargin) { 
      contentLayoutParams.bottomMargin = bottomMargin[0]; 
      contentLayout.setLayoutParams(contentLayoutParams); 
      unFocusBindView(); 
    } 
 
    @Override 
    protected void onPostExecute(Integer bottomMargin) { 
      contentLayoutParams.bottomMargin = bottomMargin; 
      contentLayout.setLayoutParams(contentLayoutParams); 
    } 
  } 
   
  class DownMenuScrollTask extends AsyncTask<Integer, Integer, Integer> { 
 
    @Override 
    protected Integer doInBackground(Integer... speed) { 
      int topMargin = contentLayoutParams.topMargin; 
      // 根據(jù)傳入的速度來滾動界面,當滾動到達邊界值時,跳出循環(huán)。 
      while (true) { 
        topMargin = topMargin + speed[0]; 
        if (topMargin < -downMenuLayoutParams.height) { 
          topMargin = -downMenuLayoutParams.height; 
          break; 
        } 
        if (topMargin > 0) { 
          topMargin = 0; 
          break; 
        } 
        publishProgress(topMargin); 
        // 為了要有滾動效果產(chǎn)生,每次循環(huán)使線程睡眠一段時間,這樣肉眼才能夠看到滾動動畫。 
        sleep(15); 
      } 
      if (speed[0] > 0) { 
        isDownMenuVisible = false; 
      } else { 
        isDownMenuVisible = true; 
      } 
      isSliding = false; 
      return topMargin; 
    } 
 
    @Override 
    protected void onProgressUpdate(Integer... topMargin) { 
      contentLayoutParams.topMargin = topMargin[0]; 
      contentLayout.setLayoutParams(contentLayoutParams); 
      unFocusBindView(); 
    } 
 
    @Override 
    protected void onPostExecute(Integer topMargin) { 
      contentLayoutParams.topMargin = topMargin; 
      contentLayout.setLayoutParams(contentLayoutParams); 
    } 
  } 
  /** 
   * 使當前線程睡眠指定的毫秒數(shù)。 
   * 
   * @param millis 
   *      指定當前線程睡眠多久,以毫秒為單位 
   */ 
  private void sleep(long millis) { 
    try { 
      Thread.sleep(millis); 
    } catch (InterruptedException e) { 
      e.printStackTrace(); 
    } 
  } 
  /** 
   * 使用可以獲得焦點的控件在滑動的時候失去焦點。 
   */ 
  private void unFocusBindView() { 
    if (mBindView != null) { 
      mBindView.setPressed(false); 
      mBindView.setFocusable(false); 
      mBindView.setFocusableInTouchMode(false); 
    } 
  } 
   
  /** 
   * 將界面滾動到上側(cè)菜單界面,滾動速度設(shè)定為-30. 
   */ 
  public void scrollToUpMenu() { 
    new UpMenuScrollTask().execute(-30); 
  } 
 
  /** 
   * 將界面滾動到下側(cè)菜單界面,滾動速度設(shè)定為-30. 
   */ 
  public void scrollToDownMenu() { 
    new DownMenuScrollTask().execute(-30); 
  } 
 
  /** 
   * 將界面從上側(cè)菜單滾動到內(nèi)容界面,滾動速度設(shè)定為30. 
   */ 
  public void scrollToContentFromUpMenu() { 
    new UpMenuScrollTask().execute(30); 
  } 
 
  /** 
   * 將界面從下側(cè)菜單滾動到內(nèi)容界面,滾動速度設(shè)定為30. 
   */ 
  public void scrollToContentFromDownMenu() { 
    new DownMenuScrollTask().execute(30); 
  } 
 
  /** 
   * 上側(cè)菜單是否完全顯示出來,滑動過程中此值無效。 
   * 
   * @return 上側(cè)菜單完全顯示返回true,否則返回false。 
   */ 
  public boolean isUpLayoutVisible() { 
    return isUpMenuVisible; 
  } 
 
  /** 
   * 下側(cè)菜單是否完全顯示出來,滑動過程中此值無效。 
   * 
   * @return 下側(cè)菜單完全顯示返回true,否則返回false。 
   */ 
  public boolean isDownLayoutVisible() { 
    return isDownMenuVisible; 
  } 
 
  /** 
   * 在onLayout中重新設(shè)定上側(cè)菜單、下側(cè)菜單、以及內(nèi)容布局的參數(shù)。 
   */ 
  @Override 
  protected void onLayout(boolean changed, int l, int t, int r, int b) { 
    super.onLayout(changed, l, t, r, b); 
    if (changed) { 
      // 獲取上側(cè)菜單布局對象 
      upMenuLayout = getChildAt(0); 
      upMenuLayoutParams = (MarginLayoutParams) upMenuLayout.getLayoutParams(); 
      // 獲取下側(cè)菜單布局對象 
      downMenuLayout = getChildAt(1); 
      downMenuLayoutParams = (MarginLayoutParams) downMenuLayout.getLayoutParams(); 
      // 獲取內(nèi)容布局對象 
      contentLayout = getChildAt(2); 
      contentLayoutParams = (RelativeLayout.LayoutParams) contentLayout.getLayoutParams(); 
      contentLayoutParams.height = screenHeight; 
      contentLayout.setLayoutParams(contentLayoutParams); 
    } 
  } 
  /** 
   * 回收VelocityTracker對象。 
   */ 
  private void recycleVelocityTracker() { 
    mVelocityTracker.recycle(); 
    mVelocityTracker = null; 
  } 
} 

下面是使用實例:

import android.os.Bundle; 
import android.widget.ArrayAdapter; 
import android.widget.LinearLayout; 
import android.widget.ListView; 
import android.app.Activity; 
 
/** 
 * 滑動菜單Demo主Activity 
 * 
 * @author guolin 
 */ 
public class MainActivity2 extends Activity { 
 
  /** 
   * 雙向滑動菜單布局 
   */ 
  private UpAndDownSlidinglayout updownSldingLayout; 
 
  /** 
   * 在內(nèi)容布局上顯示的ListView 
   */ 
  private ListView contentList; 
  private LinearLayout ll; 
  /** 
   * ListView的適配器 
   */ 
  private ArrayAdapter<String> contentListAdapter; 
 
  /** 
   * 用于填充contentListAdapter的數(shù)據(jù)源。 
   */ 
  private String[] contentItems = { "Content Item 1", "Content Item 2", "Content Item 3", 
      "Content Item 4", "Content Item 5", "Content Item 6", "Content Item 7", 
      "Content Item 8", "Content Item 9", "Content Item 10", "Content Item 11", 
      "Content Item 12", "Content Item 13", "Content Item 14", "Content Item 15", 
      "Content Item 16" }; 
 
  @Override 
  protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_main2); 
    ll = (LinearLayout) findViewById(R.id.content); 
    updownSldingLayout = (UpAndDownSlidinglayout) findViewById(R.id.updown_sliding_layout); 
    contentList = (ListView) findViewById(R.id.contentList); 
    contentListAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, 
        contentItems); 
    contentList.setAdapter(contentListAdapter); 
    updownSldingLayout.setScrollEvent(ll); 
  } 
 
} 

布局文件:

<com.example.UpAndDownSlidinglayout xmlns:android="http://schemas.android.com/apk/res/android" 
  xmlns:tools="http://schemas.android.com/tools" 
  android:id="@+id/updown_sliding_layout" 
  android:layout_width="fill_parent" 
  android:layout_height="fill_parent" > 
 
  <RelativeLayout 
    android:id="@+id/up_menu" 
    android:layout_width="fill_parent" 
    android:layout_height="300dp" 
    android:layout_alignParentTop="true" 
    android:background="#00ccff" 
    android:visibility="invisible" > 
 
    <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_centerInParent="true" 
      android:text="This is up menu" 
      android:textColor="#000000" 
      android:textSize="28sp" /> 
  </RelativeLayout> 
 
  <RelativeLayout 
    android:id="@+id/down_menu" 
    android:layout_width="fill_parent" 
    android:layout_height="300dp" 
    android:layout_alignParentBottom="true" 
    android:background="#00ffcc" 
    android:visibility="invisible" > 
 
    <TextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_centerInParent="true" 
      android:text="This is down menu" 
      android:textColor="#000000" 
      android:textSize="28sp" /> 
  </RelativeLayout> 
 
  <LinearLayout 
    android:id="@+id/content" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:gravity="center" 
    android:background="#e9e9e9" > 
 
    <ListView 
      android:id="@+id/contentList" 
      android:layout_width="fill_parent" 
      android:layout_height="500dp" 
      android:scrollbars="none" 
      android:cacheColorHint="#00000000" > 
    </ListView> 
  </LinearLayout> 
 
</com.example.UpAndDownSlidinglayout> 

以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • Android實現(xiàn)生成二維碼并保存到相冊

    Android實現(xiàn)生成二維碼并保存到相冊

    這篇文章主要介紹了如何利用Android實現(xiàn)二維碼的生成,并且保存到本地相冊。文中的示例代碼講解詳細,感興趣的小伙伴快跟隨小編學習一下
    2022-04-04
  • Android?Studio實現(xiàn)簡單頁面跳轉(zhuǎn)的詳細教程

    Android?Studio實現(xiàn)簡單頁面跳轉(zhuǎn)的詳細教程

    這篇文章主要給大家介紹了關(guān)于Android?Studio實現(xiàn)簡單頁面跳轉(zhuǎn)的詳細教程,文中通過圖文介紹的非常詳細,對大家學習或者使用Android?Studio具有一定的參考學習價值,需要的朋友可以參考下
    2023-01-01
  • Android框架Volley使用之Json請求實現(xiàn)

    Android框架Volley使用之Json請求實現(xiàn)

    這篇文章主要介紹了Android框架Volley使用之Json請求實現(xiàn),本文通過實例代碼給大家介紹的非常詳細,具有一定的參考借鑒價值 ,需要的朋友可以參考下
    2019-05-05
  • Android應用實現(xiàn)安裝后自啟動的方法

    Android應用實現(xiàn)安裝后自啟動的方法

    今天小編就為大家分享一篇Android應用實現(xiàn)安裝后自啟動的方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2018-08-08
  • Android仿微信主界面的實現(xiàn)方法

    Android仿微信主界面的實現(xiàn)方法

    這篇文章主要為大家詳細介紹了Android仿微信主界面的實現(xiàn)方法,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2018-04-04
  • android 多線程技術(shù)應用

    android 多線程技術(shù)應用

    能夠在屏幕上“實時地顯示”時間的流逝,單線程程序是無法實現(xiàn)的,必須要多線程程序才可以實現(xiàn),即便有些計算機語言可以通過封裝好的類實現(xiàn)這一功能,但從本質(zhì)上講這些封裝好的類就是封裝了一個線程,具體祥看本文
    2012-12-12
  • Android10 啟動Zygote源碼解析

    Android10 啟動Zygote源碼解析

    這篇文章主要為大家介紹了Android 10 啟動分析之Zygote篇,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪
    2022-10-10
  • Android自定義RadioGroupX實現(xiàn)多行多列布局

    Android自定義RadioGroupX實現(xiàn)多行多列布局

    這篇文章主要為大家詳細介紹了Android自定義RadioGroupX實現(xiàn)多行多列布局,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2021-09-09
  • Android 仿微信數(shù)字鍵盤

    Android 仿微信數(shù)字鍵盤

    大部分的金融App會對默認的數(shù)字鍵盤進行處理,以實現(xiàn)自定義的數(shù)字安全鍵盤?;诖?,本文對對微信數(shù)字鍵盤樣式進行了仿寫,實現(xiàn)了一套自定義的數(shù)字安全鍵盤(支持隨機數(shù)字分布)。
    2021-05-05
  • Android 網(wǎng)絡(luò)圖片查看顯示的實現(xiàn)方法

    Android 網(wǎng)絡(luò)圖片查看顯示的實現(xiàn)方法

    本篇文章小編為大家介紹,Android 網(wǎng)絡(luò)圖片查看顯示的實現(xiàn)方法,需要的朋友參考下
    2013-04-04

最新評論

忻州市| 张北县| 舟山市| 侯马市| 临湘市| 聂拉木县| 桦川县| 桃江县| 会同县| 息烽县| 安龙县| 兴海县| 漾濞| 隆化县| 柳河县| 长兴县| 虎林市| 闸北区| 吴江市| 阜宁县| 灵丘县| 遵化市| 紫阳县| 云安县| 福安市| 江山市| 会泽县| 平度市| 天长市| 固原市| 安岳县| 宾川县| 毕节市| 乌拉特前旗| 遂昌县| 岳池县| 濉溪县| 芷江| 白水县| 日土县| 静海县|