0
我只是在使用android studio的一天。我必須爲我的學校項目創建一個應用程序,我這樣做了,我在android studio中編寫了它,並且沒有錯誤。請幫幫忙, 這是最主要的活動命名frontpagee應用程序在運行時不顯示任何東西
package com.example.lenovo.shop_easy;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
public class frontpagee extends Activity
{
public void sendMessage(View view){
Intent intent = new Intent(frontpagee.this, catalog.class);
startActivity(intent);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_frontpagee, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
的XML是這樣的
我想從這項活動的第二項活動被命名爲目錄移動 Java是
package com.example.lenovo.shop_easy;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
public class catalog extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_catalog);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_catalog, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
public void sendMessage(View view) {
Intent intent = new Intent(catalog.this, product1.class);
startActivity(intent);
}
public void sendMessage1(View view) {
Intent intent = new Intent(catalog.this, PRODUCT2.class);
startActivity(intent);
}
public void sendMessage2(View view) {
Intent intent = new Intent(catalog.this, PRODUCT3.class);
startActivity(intent);
}
public void sendMessage3(View view) {
Intent intent = new Intent(catalog.this, product4.class);
startActivity(intent);
}
public void sendMessage4(View view) {
Intent intent = new Intent(catalog.this, product5.class);
startActivity(intent);
}
public void sendMessage5(View view) {
Intent intent = new Intent(catalog.this, product6.class);
startActivity(intent);
}
public void sendMessage6(View view) {
Intent intent = new Intent(catalog.this, product7.class);
startActivity(intent);
}
public void sendMessage7(View view) {
Intent intent = new Intent(catalog.this, product8.class);
startActivity(intent);
}
public void sendMessage8(View view) {
Intent intent = new Intent(catalog.this, product9.class);
startActivity(intent);
}
public void sendMessage9(View view) {
Intent intent = new Intent(catalog.this, product10.class);
startActivity(intent);
}
}
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".frontpagee"
android:background="@drawable/back">
<ImageView
android:layout_width="472dp"
android:layout_height="500dp"
android:id="@+id/imageView11"
android:src="@mipmap/cover"
android:layout_gravity="center_horizontal|top"
android:contentDescription="@string/content" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/text12"
android:id="@+id/button11"
android:layout_gravity="center_horizontal|bottom"
android:textSize="@dimen/size2"
android:clickable="true"
android:onClick="sendMessage"/>
</FrameLayout>
代碼是正確的說android的工作室,但是當我在我的手機上運行adb它安裝應用程序,一切都很好,但是當我打開應用程序時,它只顯示應用程序圖標和名稱,否則該怎麼做。請幫助
和這裏的主要xml文件也
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.lenovo.shop_easy" >
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".frontpagee"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".catalog"
android:label="@string/title_activity_catalog" >
</activity>
<activity
android:name=".product1"
android:label="@string/title_activity_product1" >
</activity>
<activity
android:name=".PRODUCT2"
android:label="@string/title_activity_product2" >
</activity>
<activity
android:name=".PRODUCT3"
android:label="@string/title_activity_product3" >
</activity>
<activity
android:name=".product4"
android:label="@string/title_activity_product4" >
</activity>
<activity
android:name=".product5"
android:label="@string/title_activity_product5" >
</activity>
<activity
android:name=".product6"
android:label="@string/title_activity_product6" >
</activity>
<activity
android:name=".product7"
android:label="@string/title_activity_product7" >
</activity>
<activity
android:name=".product8"
android:label="@string/title_activity_product8" >
</activity>
<activity
android:name=".product9"
android:label="@string/title_activity_product9" >
</activity>
<activity
android:name=".product10"
android:label="@string/title_activity_product10" >
</activity>
</application>
</manifest>
做什麼