无名 发表于 2022-5-8 18:23:55

【GD】aide代码教程

话不多说,开更[滑稽]
沉浸式状态栏教程

在setContentView(R.layout.main);上面添加代码:
//沉浸式状态栏
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT){
Window window = getWindow();
window.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}

然后再在布局一开始的布局控件(设置背景颜色)里面添加:
android:fitsSystemWindows=true
android:clipToPadding=true

跳转QQ或者QQ群代码教程跳转QQ代码:

Intent intent =new Intent();intent.setData(Uri.parse("mqqwpa://im/chat?chat_type=wpa&uin=QQ号"));intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);startActivity(intent);

跳转QQ群:
startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse("mqqapi://card/show_pslcard?src_type=internal&version=群号&card_type=group&source=qrcode")));

打开/关闭闪光灯代码教程

       

//打开闪光灯
Cameracamera = Camera.open();
                                        camera.startPreview();
                                        //打开闪光灯
                                        Camera.Parameters parameter = camera.getParameters();
                                        parameter.setFlashMode(Parameters.FLASH_MODE_TORCH);
                                        camera.setParameters(parameter);

//关闭闪光灯
Cameracamera = Camera.open();
                                        camera.startPreview();
                                        //关闭闪光灯
                                        Camera.Parameters parameter = camera.getParameters();
                                        parameter.setFlashMode(Parameters.FLASH_MODE_OFF);
                                        camera.setParameters(parameter);

软件分享代码教程

Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);                                       
Toast.makeText(GugleFileActivity.this,"好东西要分享哦",Toast.LENGTH_SHORT).show();                               
shareIntent.putExtra(Intent.EXTRA_TEXT,"分享的内容");                                       
shareIntent.setType("text/plain");                               
startActivity(Intent.createChooser(shareIntent, "分享到"));
http://cdn.u1.huluxia.com/g3/M01/EB/8A/wKgBOV4lnVuAcMHEAAJD5BefOWQ668.jpg
页: [1]
查看完整版本: 【GD】aide代码教程