欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

android浮窗,android 懸浮窗實(shí)現(xiàn)

Android 浮窗按鈕FloatActionButton

android.support.design.widget.CoordinatorLayout

站在用戶的角度思考問題,與客戶深入溝通,找到輪臺(tái)網(wǎng)站設(shè)計(jì)與輪臺(tái)網(wǎng)站推廣的解決方案,憑借多年的經(jīng)驗(yàn),讓設(shè)計(jì)與互聯(lián)網(wǎng)技術(shù)結(jié)合,創(chuàng)造個(gè)性化、用戶體驗(yàn)好的作品,建站類型包括:網(wǎng)站設(shè)計(jì)、成都網(wǎng)站制作、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣、域名與空間、虛擬空間、企業(yè)郵箱。業(yè)務(wù)覆蓋輪臺(tái)地區(qū)。

android:layout_width="match_parent"

android:layout_height="match_parent"

其他控件

android.support.design.widget.FloatingActionButton

android:id="@+id/pro_departmeng_fab"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:src="@mipmap/pro_button"

android:onClick="onClick"

app:layout_anchor="@id/bc_pro_department"

app:layout_anchorGravity="right|top"

android:layout_marginRight="@dimen/size5"

app:rippleColor="@color/colorPrimary"

app:borderWidth="@dimen/size0"

android:elevation="@dimen/size5"

android:backgroundTint="@color/white"

app:fabSize="mini"/

//初始化

@Bind(R.id.pro_departmeng_fab)

FloatingActionButtonproDepartmengFab;

//監(jiān)聽事件

proDepartmengFab.setOnClickListener(newView.OnClickListener() {

@Override

public voidonClick(View view) {

Toast.makeText(getContext(),"test",Toast.LENGTH_LONG).show();

}

});

四、屬性介紹

1、app:borderWidth=""------------------邊框?qū)挾龋ǔTO(shè)置為0 ,用于解決Android 5.X設(shè)備上陰影無法正常顯示的問題

2、app:backgroundTint=""---------------按鈕的背景顏色,不設(shè)置,默認(rèn)使用theme中colorAccent的顏色

3、app:rippleColor=""--------------------點(diǎn)擊的邊緣陰影顏色

4、app:elevation=""----------------------邊緣陰影的寬度

5、app:pressedTranslationZ="16dp"-----點(diǎn)擊按鈕時(shí),按鈕邊緣陰影的寬度,通常設(shè)置比elevation的數(shù)值大

android 系統(tǒng)級(jí)的懸浮窗實(shí)現(xiàn)

當(dāng)我們?cè)谑褂玫腶pp的時(shí)候,如果需要實(shí)時(shí)觀測到某個(gè)功能的實(shí)時(shí)進(jìn)度并且不影響其他的操作的時(shí)候或者不影響使用其他應(yīng)用的時(shí)候,系統(tǒng)級(jí)的懸浮球是個(gè)非常不錯(cuò)的選擇。

public class QueueUpFloatService extends Service {

/**

* 啟動(dòng)服務(wù)并傳值

*

* @param activity 啟動(dòng)服務(wù)的activity

* @param modeBean 數(shù)據(jù)對(duì)象

*/

public static void launchService(Activity activity, ModeBean modeBean) {

try {

Intent intent =new Intent(activity, QueueUpFloatService.class);

? ? Bundle bundle =new Bundle();

? ? bundle.putSerializable(KEY_MODEL, modeBean);

? ? intent.putExtras(bundle);

? ? activity.startService(intent);

}catch (Exception e) {

e.printStackTrace();

}

}

@Override

public void onCreate() {

super.onCreate();

}

@Override

public IBinder onBind(Intent intent) {

return null;

}

@Override

public int onStartCommand(Intent intent, int flags, int startId) {

return super.onStartCommand(intent, flags, startId);

}

@Override

public void onDestroy() {

super.onDestroy();

}

}

@Override

public void onCreate() {

super.onCreate();

//加一點(diǎn)簡單的動(dòng)畫?

buttonScale = (ScaleAnimation) AnimationUtils.loadAnimation(this, R.anim.anim_float);

windowManager = (WindowManager) getSystemService(WINDOW_SERVICE);

layoutParams =new WindowManager.LayoutParams();

if (Build.VERSION.SDK_INT = Build.VERSION_CODES.O) {

layoutParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;

}else {

layoutParams.type = WindowManager.LayoutParams.TYPE_PHONE;

}

layoutParams.format = PixelFormat.RGBA_8888;

layoutParams.gravity = Gravity.LEFT | Gravity.TOP;

layoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | ????????????WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;

layoutParams.width = ScreenUtils.dp2px(66);

layoutParams.height = ScreenUtils.dp2px(66);

layoutParams.x = ScreenUtils.getRealWidth() - ScreenUtils.dp2px(60);

layoutParams.y = ScreenUtils.deviceHeight() *2 /3;

}

@Override

public int onStartCommand(Intent intent, int flags, int startId) {

ModeBean modeBean = (ModeBean) intent.getExtras().getSerializable(KEY_MODEL);

LayoutInflater layoutInflater = LayoutInflater.from(this);

floatView = layoutInflater.inflate(R.layout.view_float, null);

RelativeLayout rlFloatParent =floatView.findViewById(R.id.rl_float_parent);

rlFloatParent.startAnimation(buttonScale);

TextView tvIndex =floatView.findViewById(R.id.tv_queue_index);

tvIndex.setText(modeBean.title);

floatView.findViewById(R.id.iv_close_float).setOnClickListener(v - stopSelf());

//修改懸浮球的滑動(dòng)實(shí)現(xiàn)

floatView.setOnTouchListener(new FloatingOnTouchListener());

windowManager.addView(floatView, layoutParams);

return super.onStartCommand(intent, flags, startId);

}

private class FloatingOnTouchListenerimplements View.OnTouchListener {

private int x;

private int y;

private long downTime;

@SuppressLint("ClickableViewAccessibility")

@Override

public boolean onTouch(View view, MotionEvent event) {

switch (event.getAction()) {

case MotionEvent.ACTION_DOWN:

downTime = System.currentTimeMillis();

? ? ? ? ? ? ????????x = (int) event.getRawX();

? ? ? ? ? ????????? y = (int) event.getRawY();

break;

? ? ? ????? case MotionEvent.ACTION_MOVE:

int nowX = (int) event.getRawX();

? ? ????????? ? ? ? int nowY = (int) event.getRawY();

? ? ? ????????? ? ? int movedX = nowX -x;

? ? ? ? ????????? ? int movedY = nowY -y;

? ? ? ? ????????? ? x = nowX;

? ? ? ? ? ????????? y = nowY;

? ? ? ? ? ????????? layoutParams.x =layoutParams.x + movedX;

? ? ? ? ? ? ????????layoutParams.y =layoutParams.y + movedY;

? ? ? ? ? ? ? ? ? ? windowManager.updateViewLayout(view, layoutParams);

break;

? ? ? ????? case MotionEvent.ACTION_UP:

/* *

* 這里根據(jù)手指按下和抬起的時(shí)間差來判斷點(diǎn)擊事件還是滑動(dòng)事件

* */

? ? ? ? ????????? ? if ((System.currentTimeMillis() -downTime) 200) {

? ? ? ? ? ? ? ? ? ? ? ? ? ? //檢測應(yīng)用在前臺(tái)還是后臺(tái)

if (AppUtils.isAppIsInBackground()) {

AppUtils.moveToFront(CloseActivityUtils.activityList.get(CloseActivityUtils.activityList.size() -1).getClass());

? ? ? ? ? ? ? ????????????? } else {

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? //檢測棧頂是否為SecondActivity 不是就打開SecondActivity

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (!CloseActivityUtils.activityList.get(CloseActivityUtils.activityList.size() -1)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ????????????????.getClass().getSimpleName().contains("SecondActivity")) {

? ? ? ? ? ? ? ? ? ? ? ? ? ????????? SecondActivity.launchActivity(CloseActivityUtils.activityList.get(CloseActivityUtils.activityList.size() -1));

? ? ? ? ? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ? ? }

}

break;

? ? ? ? default:

break;

? ? }

? ?return false;

}

}

@Override

public void onDestroy() {

super.onDestroy();

if (null ==floatView) {

return;

? ? ? ? ? ?}

windowManager.removeView(floatView);

? ? ? ? windowManager=null;

}

flutter android 原生浮窗組件 android_window 介紹

倉庫地址:

pub 地址:

修改 MainActivity.kt 讓 MainActivity 繼承 qiuxiang.android_window.AndroidWindowActivity :

創(chuàng)建 MainApplication.kt :

修改 AndroidManifest.xml 的 application 新增屬性 android:name=".MainApplication" :

main.dart:

我們需要用 @pragma('vm:entry-point') 聲明一個(gè)入口函數(shù),默認(rèn)函數(shù)名是 androidWindow ,當(dāng)然你可以隨意指定一個(gè),只是調(diào)用 open 的時(shí)候需要同時(shí)指定參數(shù) entryPoint: 。

android_window.dart:

浮窗 app 的寫法就和我們平時(shí)寫的 app 沒什么區(qū)別了,如果需要支持窗口拖拽移動(dòng),則要在最外層使用 AndroidWindow 。

最終效果:

更完整的示例請(qǐng)參考:

主應(yīng)用和浮窗都有 post 和 setHandler 方法用于發(fā)送消息以及設(shè)置監(jiān)聽處理函數(shù)。用法舉例:

主應(yīng)用發(fā)送消息到浮窗:

浮窗監(jiān)聽并處理主應(yīng)用消息:

反過來同理。

Android視頻懸浮窗口實(shí)現(xiàn)

本文例子實(shí)現(xiàn)了點(diǎn)擊顯示懸浮窗口,同時(shí)窗口可播放視頻,拖動(dòng)位置,點(diǎn)擊關(guān)閉及返回 APP 頁面,通過例子來講述懸浮窗口實(shí)現(xiàn)原理及細(xì)節(jié)處理,效果圖如下所示:

關(guān)于懸浮窗的一些基本操作到這里就基本結(jié)束了,具體的布局內(nèi)容及操作,歡迎查看具體的源碼實(shí)現(xiàn): Github開發(fā)記錄

歡迎點(diǎn)擊查閱及Star,我也會(huì)繼續(xù)補(bǔ)充其它有用的知識(shí)及例子在項(xiàng)目上。

歡迎點(diǎn)贊/評(píng)論,你們的贊同和鼓勵(lì)是我寫作的最大動(dòng)力!

android 微信小程序支付 開啟顯示懸浮窗 權(quán)限

1、首先打開微信軟件app。

2、進(jìn)去后主頁后找到右下角的我的。

3、然后點(diǎn)擊一下。

4、進(jìn)去我的以后找到設(shè)置并點(diǎn)擊進(jìn)去。

5、找到顯示懸浮窗點(diǎn)擊一下并選擇小程序支付就開啟顯示懸浮窗了。

網(wǎng)站欄目:android浮窗,android 懸浮窗實(shí)現(xiàn)
鏈接分享:http://chinadenli.net/article23/dsespjs.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供用戶體驗(yàn)ChatGPT微信小程序網(wǎng)站設(shè)計(jì)公司網(wǎng)站收錄網(wǎng)站設(shè)計(jì)

廣告

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

成都定制網(wǎng)站建設(shè)