我已经让它启动启动屏幕然后转到主菜单,但我似乎无法让我的图像按钮将我带到下一个屏幕(它停止工作),如果你愿意帮助我会很多欣赏它。以下是我的清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.iimed.www"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="18"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="org.iimed.www.Splashscreen"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Black.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="org.iimed.www.MainActivity"
android:label="@string/app_name">
</activity>
<ImageButton
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:onClick="myClickHandler"
android:src="@drawable/ic_launcher" android:contentDescription="@id/button"/>
<activity
android:name="org.iimed.www.vpbox"
android:label="@string/app_name">
</activity>
</application>
</manifest>enter code here
这是我的 MainActivity java
package org.iimed.www;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.widget.ImageButton;
import android.view.View.OnClickListener;
import android.content.ComponentName;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ImageButton btn = (ImageButton) findViewById(R.id.button);
btn.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v){
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(new ComponentName("org.iimed.www,","org.iimed.www.vpbox"));
startActivity(intent);
}
});
}
}
这是我希望按钮带我到的屏幕的java:
package org.iimed.www;
import android.os.Bundle;
import android.app.Activity;
public class vpbox extends Activity {
public void onCreate(Bundle vpbox_activity) {
setContentView(R.layout.vpbox_activity);
}
}