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

Android懸浮按鈕的使用方法

 更新時間:2018年06月02日 12:28:40   作者:北極熊的微笑  
這篇文章主要為大家詳細介紹了Android懸浮按鈕的使用方法,具有一定的參考價值,感興趣的小伙伴們可以參考一下

懸浮按鈕效果如下圖所示:

步驟1:引用

compile 'com.laocaixw.suspendbuttonlayout:suspendbuttonlayout:1.0.3' 

步驟2:xml布局

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout android:layout_height="match_parent" 
 android:layout_width="match_parent" 
 android:orientation="vertical" 
 xmlns:suspend="http://schemas.android.com/apk/res-auto" 
 xmlns:android="http://schemas.android.com/apk/res/android"> 
 
 <com.laocaixw.layout.SuspendButtonLayout 
  android:id="@+id/layout" 
  android:layout_width="match_parent" 
  android:layout_height="match_parent" 
  suspend:distance="80dp" 
  suspend:imageSize="50dp" 
  suspend:marginY="100dp" 
  suspend:number="6" 
  suspend:imageMainOpen="@mipmap/suspend_main_open" 
  suspend:imageMainClose="@mipmap/suspend_main_close" 
  suspend:image1="@mipmap/suspend_1" 
  suspend:image2="@mipmap/suspend_2" 
  suspend:image3="@mipmap/suspend_3" 
  suspend:image4="@mipmap/suspend_4" 
  suspend:image5="@mipmap/suspend_5" 
  suspend:image6="@mipmap/suspend_6"> 
 
 </com.laocaixw.layout.SuspendButtonLayout> 
 
</LinearLayout> 

以上各屬性:

  • distance="80dp" // 按鈕打開后,主按鈕和子按鈕的距離
  • imageSize="50dp" // 按鈕大小,所占區(qū)域的邊長
  • marginY="100dp" // 與上下邊緣距離,下圖中黃色部分的高度
  • number="6" // 展開的子按鈕的數(shù)量,可以是3-6個
  • imageMainOpen="@mipmap/suspendMainOpen" // 中間按鈕展開時的圖片資源
  • imageMainClose="@mipmap/suspendMainClose" // 中間按鈕關(guān)閉時的圖片資源
  • image1="@mipmap/suspend_1" // 子按鈕的圖片資源,image1~image6

步驟3:Activity使用

public class MainActivity extends AppCompatActivity { 
 
 public String[] suspendChildButtonInfo = {"相機", "音樂", "地圖", "亮度", "聯(lián)系人", "短信"}; 
 
 @Override 
 protected void onCreate(Bundle savedInstanceState) { 
  super.onCreate(savedInstanceState); 
  setContentView(R.layout.activity_suspendbutton); 
 
  final SuspendButtonLayout suspendButtonLayout = (SuspendButtonLayout) findViewById(R.id.layout); 
  suspendButtonLayout.setOnSuspendListener(new SuspendButtonLayout.OnSuspendListener() { 
   @Override 
   public void onButtonStatusChanged(int status) { 
 
   } 
 
   @Override 
   public void onChildButtonClick(int index) { 
    Toast.makeText(MainActivity.this, "您點擊了【" 
      + suspendChildButtonInfo[index - 1] + "】按鈕!", Toast.LENGTH_SHORT).show(); 
   } 
  }); 
 
/**  

 * suspendButtonLayout.hideSuspendButton(); // 隱藏按鈕 
  suspendButtonLayout.showSuspendButton(); // 顯示按鈕 
 
  suspendButtonLayout.openSuspendButton(); // 展開按鈕 
  suspendButtonLayout.closeSuspendButton(); // 關(guān)閉按鈕 
 
  suspendButtonLayout.setMainCloseImageResource(R.mipmap.suspend_main_close); // 設(shè)置關(guān)閉時,主按鈕的圖片 
  suspendButtonLayout.setMainOpenImageResource(R.mipmap.suspend_main_open); // 設(shè)置展開時,主按鈕的圖片 
 
  // 設(shè)置按鈕位置。isRight:true在右邊,false在左邊;stayPosY:在'按鈕停留區(qū)域'從上往下,值為從0到100。 
  suspendButtonLayout.setPosition(isRight, stayPosY); */ 
 
 
 } 
} 

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

相關(guān)文章

  • Android GridView簡單實例

    Android GridView簡單實例

    這篇文章主要為大家詳細介紹了Android GridView簡單實例,簡單實現(xiàn)九宮格效果,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2017-01-01
  • android中NFC讀寫功能的實現(xiàn)方法

    android中NFC讀寫功能的實現(xiàn)方法

    這篇文章主要為大家詳細介紹了android中NFC讀寫功能的實現(xiàn)方法,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2021-09-09
  • 支付寶咻一咻怎么用 Android幫你實現(xiàn)咻一咻

    支付寶咻一咻怎么用 Android幫你實現(xiàn)咻一咻

    Android幫你實現(xiàn)咻一咻,這篇文章主要為大家介紹了支付寶咻一咻的幾種思路,感興趣的朋友可以參考一下
    2016-02-02
  • Android 自定義view實現(xiàn)TopBar效果

    Android 自定義view實現(xiàn)TopBar效果

    這篇文章主要為大家詳細介紹了Android 自定義view實現(xiàn)TopBar效果,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2017-09-09
  • 基于Android?Kotlin高頻面試題解析

    基于Android?Kotlin高頻面試題解析

    這篇文章主要為大家介紹了基于Android?Kotlin高頻面試題解析,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪
    2023-07-07
  • Android studio 添加assets文件夾的方法

    Android studio 添加assets文件夾的方法

    這篇文章主要介紹了Android studio 添加assets文件夾的方法,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-07-07
  • Android ProgressDialog使用總結(jié)

    Android ProgressDialog使用總結(jié)

    ProgressDialog 繼承自AlertDialog,AlertDialog繼承自Dialog,實現(xiàn)DialogInterface接口,本文給大家介紹Android ProgressDialog使用總結(jié)的相關(guān)知識,需要的朋友通過此文一起學習吧
    2016-01-01
  • 關(guān)于Kotlin委托你必須重視的幾個點

    關(guān)于Kotlin委托你必須重視的幾個點

    委托模式已經(jīng)被證明是實現(xiàn)繼承的一個很好的替代方式,下面這篇文章主要給大家介紹了關(guān)于Kotlin委托你必須重視的幾個點,文中通過實例代碼介紹的非常詳細,需要的朋友可以參考下
    2022-01-01
  • Android 實現(xiàn)將Bitmap 保存到本地

    Android 實現(xiàn)將Bitmap 保存到本地

    這篇文章主要介紹了Android 實現(xiàn)將Bitmap 保存到本地,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2020-03-03
  • Android中SurfaceFlinger工作原理

    Android中SurfaceFlinger工作原理

    這篇文章介紹了Android中SurfaceFlinger的工作原理,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2021-12-12

最新評論

上犹县| 许昌县| 乃东县| 买车| 延津县| 宁安市| 昭觉县| 邯郸市| 赣州市| 手游| 平陆县| 左权县| 灵丘县| 时尚| 顺平县| 阿拉尔市| 额尔古纳市| 横山县| 通榆县| 广西| 新源县| 珠海市| 林甸县| 格尔木市| 彰化市| 湄潭县| 宿迁市| 平凉市| 九江县| SHOW| 顺昌县| 昌图县| 宁南县| 静安区| 沧州市| 鄱阳县| 巩留县| 禄劝| 翼城县| 苍南县| 梅河口市|