免费观看又色又爽又黄的小说免费_美女福利视频国产片_亚洲欧美精品_美国一级大黄大色毛片

Android實現(xiàn)IOS選擇拍照相冊底部彈出的實例

Android 實現(xiàn)IOS選擇拍照相冊底部彈出的實例

創(chuàng)新互聯(lián)建站堅持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:成都網(wǎng)站設(shè)計、成都網(wǎng)站制作、企業(yè)官網(wǎng)、英文網(wǎng)站、手機端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時代的榆陽網(wǎng)站設(shè)計、移動媒體設(shè)計的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!

效果圖

Android 實現(xiàn)IOS選擇拍照相冊底部彈出的實例

1. AndroidStudio使用

dependencies {

  compile 'com.guoqi.widget:actionsheet:1.0'

}

2. 使用

//1.實現(xiàn)接口

 implements ActionSheet.OnActionSheetSelected


//2.在某個點擊事件中添加:
 ActionSheet.showSheet(this, this, null);


//3.然后重寫點擊方法:
@Override
  public void onClick(int whichButton) {
    switch (whichButton) {
      case ActionSheet.CHOOSE_PICTURE:
        //相冊
        choosePic();
        break;
      case ActionSheet.TAKE_PICTURE:
        //拍照
        takePic();
        break;
      case ActionSheet.CANCEL:
        //取消
        break;
    }
  } 


//加入自己的邏輯
public void takePic(){
 String state = Environment.getExternalStorageState();
        if (state.equals(Environment.MEDIA_MOUNTED)) {
          Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
          File outDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
          if (!outDir.exists()) {
            outDir.mkdirs();
          }
          File outFile = new File(outDir, System.currentTimeMillis() + ".jpg");
          picPath = outFile.getAbsolutePath();
          intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(outFile));
          intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
          startActivityForResult(intent, ActionSheet.TAKE_PICTURE);
        } else {
          Toast.makeText(this, "請確認已經(jīng)插入SD卡", Toast.LENGTH_SHORT).show();
        }
}



//加入自己的邏輯
public void choosePic(){
  Intent openAlbumIntent = new Intent(Intent.ACTION_PICK);
        openAlbumIntent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*");
        startActivityForResult(openAlbumIntent, ActionSheet.CHOOSE_PICTURE);
}



感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持,如有疑問請留言或者到本站社區(qū)交流討論,大家共同進步!

網(wǎng)站名稱:Android實現(xiàn)IOS選擇拍照相冊底部彈出的實例
URL網(wǎng)址:http://m.newbst.com/article4/jeejie.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站建設(shè)小程序開發(fā)網(wǎng)站導航服務(wù)器托管搜索引擎優(yōu)化標簽優(yōu)化

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

商城網(wǎng)站建設(shè)