gpt4 book ai didi

java - 如何在主页按钮上向上滑动打开滑动抽屉

转载 作者:行者123 更新时间:2023-11-30 02:40:35 26 4
gpt4 key购买 nike

我正在开发一个应用程序,当您在主页按钮上向上滑动时,该应用程序会打开。我已经完成了所有其他工作,打赌代码可以在主页按钮部分向上滑动时完成打开。我该怎么做呢?任何帮助都会很棒。

如果需要,这是我的 java 代码:

package com.d4a.toolbelt;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;

public class QuickLaunch extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_quick_launch);
}

/** Called when the user clicks the music button */
public void music(View view) {
Intent intent = new Intent("android.intent.action.MUSIC_PLAYER");
startActivity(intent);


}





/** Called when the user clicks the play button */
public void play(View view) {
Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.android.vending");
startActivity(launchIntent);
}



/** Called when the user clicks the web button */
public void web(View view) {
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://google.com/"));
startActivity(browserIntent);

}

/** Called when the user clicks the email button */
public void email(View view) {
Intent intent = getPackageManager().getLaunchIntentForPackage("com.android.email");
startActivity(intent);

}

/** Called when the user clicks the sms button */
public void chat(View view) {
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(new ComponentName("com.d4a.sms","de.ub0r.android.smsdroid.ConversationListActivity"));
intent.putExtra("grace", "Hi");
startActivity(intent);


}


/** Called when the user clicks the settings button */
public void settings(View view) {
Intent intent = getPackageManager().getLaunchIntentForPackage("com.android.settings");
startActivity(intent);

}




/** Called when the user clicks the camara button */
public void cam(View view) {
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, 0);

}

/** Called when the user clicks the video camara button */
public void video_cam(View view) {
Intent intent = new Intent("android.media.action.VIDEO_CAPTURE");
startActivityForResult(intent, 0);

}
}

提前致谢一百万!

最佳答案

我发现您需要 list 中的这行代码:

 <intent-filter>
<action android:name="android.intent.action.ASSIST" />
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>

感谢 home launcher 是开源的,我得到了我的答案,我希望这能帮助其他人

关于java - 如何在主页按钮上向上滑动打开滑动抽屉,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25815370/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com