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

Android SlidingDrawer 抽屜效果的實(shí)現(xiàn)

 更新時(shí)間:2013年04月19日 16:43:47   作者:  
本篇文章小編為大家介紹,Android SlidingDrawer 抽屜效果的實(shí)現(xiàn)。需要的朋友參考下

SlidingDrawer隱藏屏外的內(nèi)容,并允許用戶通過(guò)handle以顯示隱藏內(nèi)容。它可以垂直或水平滑動(dòng),它有倆個(gè)View組成,其一是可以拖動(dòng)的handle,其二是隱藏內(nèi)容的View.它里面的控件必須設(shè)置布局,在布局文件中必須指定handle和content。

1、布局layou文件

復(fù)制代碼 代碼如下:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
<SlidingDrawer
  android:id="@+id/slidingdrawer"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:content="@+id/content"
  android:handle="@+id/handle"
  android:orientation="vertical" >
  <Button
    android:id="@+id/handle"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="SlidingDraser" />
  <LinearLayout <!--隱藏的內(nèi)容-->
    android:id="@+id/content"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#00ffaa" >
    <Button
      android:id="@+id/button"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="Button" />
    <EditText
      android:id="@+id/editText"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content" />
  </LinearLayout>
</SlidingDrawer>
</LinearLayout>


 2、下面是運(yùn)行程序之后的界面

另:可在drawable中添加文件

復(fù)制代碼 代碼如下:

    <?xml version="1.0" encoding="utf-8"?> 
    <selector xmlns:android="http://schemas.android.com/apk/res/android"> 
        <item android:state_window_focused="false" android:state_enabled="true" android:drawable="@drawable/handle_normal" /> 
        <item android:state_pressed="true" android:drawable="@drawable/handle_pressed" /> 
        <item android:state_focused="true" android:state_enabled="true" android:drawable="@drawable/handle_focused" /> 
        <item android:state_enabled="true" android:drawable="@drawable/handle_normal" /> 
        <item android:state_focused="true" android:drawable="@drawable/handle_focused" /> 
    </selector> 

總結(jié):

1、重要屬性

  android:allowSingleTap:指示是否可以通過(guò)handle打開(kāi)或關(guān)閉

  android:animateOnClick:指示是否當(dāng)使用者按下手柄打開(kāi)/關(guān)閉時(shí)是否該有一個(gè)動(dòng)畫。

  android:content:隱藏的內(nèi)容

  android:handle:handle(手柄)

2、重要方法

  animateClose():關(guān)閉時(shí)實(shí)現(xiàn)動(dòng)畫。

  close():即時(shí)關(guān)閉

  getContent():獲取內(nèi)容

  isMoving():指示SlidingDrawer是否在移動(dòng)。

  isOpened():指示SlidingDrawer是否已全部打開(kāi)

  lock():屏蔽觸摸事件。

  setOnDrawerCloseListener(SlidingDrawer.OnDrawerCloseListener onDrawerCloseListener):SlidingDrawer關(guān)閉時(shí)調(diào)用

  setOnDrawerOpenListener

  setOnDrawerScrollListener

  unlock():解除屏蔽觸摸事件。

  toggle():切換打開(kāi)和關(guān)閉的抽屜SlidingDrawer。

相關(guān)文章

  • Android微信端的下拉刷新功能

    Android微信端的下拉刷新功能

    在微信公眾號(hào)內(nèi),在面對(duì)下拉刷新這個(gè)問(wèn)題上,Android和iOS都自己的表現(xiàn)方式。下面通過(guò)本文給大家分享Android微信端的下拉刷新功能,需要的朋友參考下吧
    2017-06-06
  • Android仿視頻加載旋轉(zhuǎn)小球動(dòng)畫效果的實(shí)例代碼

    Android仿視頻加載旋轉(zhuǎn)小球動(dòng)畫效果的實(shí)例代碼

    這篇文章主要介紹了Android仿視頻加載旋轉(zhuǎn)小球動(dòng)畫效果的實(shí)例代碼,文中給大家提到了PathMeasure的用法,介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2018-09-09
  • Android自定義控件實(shí)現(xiàn)下拉刷新效果

    Android自定義控件實(shí)現(xiàn)下拉刷新效果

    這篇文章主要為大家詳細(xì)介紹了Android自定義控件實(shí)現(xiàn)下拉刷新效果,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-08-08
  • 手機(jī)方向傳感器的缺點(diǎn)及解決方法探究

    手機(jī)方向傳感器的缺點(diǎn)及解決方法探究

    今天小編就為大家分享一篇關(guān)于手機(jī)方向傳感器的缺點(diǎn)及解決方法探究,小編覺(jué)得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來(lái)看看吧
    2019-03-03
  • 淺析Android加載字體包及封裝的方法

    淺析Android加載字體包及封裝的方法

    這篇文章主要介紹了Android加載字體包及封裝的相關(guān)知識(shí),本文通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2020-04-04
  • Flutter中如何實(shí)現(xiàn)無(wú)Context跳轉(zhuǎn)詳解

    Flutter中如何實(shí)現(xiàn)無(wú)Context跳轉(zhuǎn)詳解

    這篇文章主要給大家介紹了關(guān)于Flutter中如何實(shí)現(xiàn)無(wú)Context跳轉(zhuǎn)的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者使用Flutter具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2019-09-09
  • Android Studio下載更新Android SDK網(wǎng)絡(luò)異?;驘o(wú)法下載

    Android Studio下載更新Android SDK網(wǎng)絡(luò)異?;驘o(wú)法下載

    這篇文章主要介紹了Android Studio下載更新Android SDK網(wǎng)絡(luò)異常或無(wú)法下載的相關(guān)資料,需要的朋友可以參考下
    2017-04-04
  • Kotlin中Stack與LinkedList的實(shí)現(xiàn)方法示例

    Kotlin中Stack與LinkedList的實(shí)現(xiàn)方法示例

    這篇文章主要給大家介紹了關(guān)于Kotlin中Stack與LinkedList實(shí)現(xiàn)的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考借鑒,下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2018-06-06
  • android RecycleView實(shí)現(xiàn)下拉刷新和上拉加載

    android RecycleView實(shí)現(xiàn)下拉刷新和上拉加載

    這篇文章主要為大家詳細(xì)介紹了android RecycleView實(shí)現(xiàn)下拉刷新和上拉加載,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2020-06-06
  • Android點(diǎn)擊EditText文本框之外任何地方隱藏鍵盤的解決辦法

    Android點(diǎn)擊EditText文本框之外任何地方隱藏鍵盤的解決辦法

    這篇文章主要介紹了Android點(diǎn)擊EditText文本框之外任何地方隱藏鍵盤的解決辦法,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下
    2017-01-01

最新評(píng)論

寻甸| 龙岩市| 西乡县| 望都县| 枣阳市| 左权县| 星子县| 旺苍县| 普安县| 读书| 博野县| 阿拉善右旗| 娱乐| 台州市| 曲阜市| 轮台县| 永登县| 兴业县| 万载县| 莱芜市| 饶河县| 洛浦县| 罗城| 沁阳市| 包头市| 嘉义县| 海南省| 平陆县| 嘉鱼县| 太原市| 洛阳市| 澄江县| 准格尔旗| 石门县| 鞍山市| 罗源县| 永善县| 阜新市| 安宁市| 沽源县| 和顺县|