Java 如何在“主页”按钮上向上滑动打开滑动抽屉
我正在开发一个应用程序,当你按下home(主页)按钮时,应用程序就会打开。我已经做了所有其他的事情,下注的代码,以完成打开对刷上主按钮的一部分。我该怎么做? 任何帮助都将是惊人的 如果需要,下面是我的java代码:Java 如何在“主页”按钮上向上滑动打开滑动抽屉,java,android,android-intent,Java,Android,Android Intent,我正在开发一个应用程序,当你按下home(主页)按钮时,应用程序就会打开。我已经做了所有其他的事情,下注的代码,以完成打开对刷上主按钮的一部分。我该怎么做? 任何帮助都将是惊人的 如果需要,下面是我的java代码: package com.d4a.toolbelt; import android.app.Activity; import android.content.ComponentName; import android.content.Intent; import android.ne
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);
}
}
提前万分感谢各位 我发现您需要清单中的这行代码:
<intent-filter>
<action android:name="android.intent.action.ASSIST" />
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
多亏HomeLauncher是开源的,我得到了我的答案,我希望这能帮助站在我立场上的其他人