我是开发新手,所以我不知道我做的对不对t 出现。所以我用谷歌搜索了一些信息并尝试了一切......这是layout/Main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher">
<LinearLayout android:orientation="vertical" android:id="@id/LLImage" android:layout_width="fill_parent" android:layout_height="wrap_content" android:adjustViewBounds="true" android:minHeight="100.0dip"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher">
<RelativeLayout android:id="@id/drag_layer" android:layout_width="fill_parent" android:layout_height="370.0dip" android:adjustViewBounds="true" android:minHeight="100.0dip">
<ImageView android:id="@id/imageViewContainer" android:layout_width="fill_parent" android:layout_height="370.0dip" android:src="@drawable/backgsammi" android:scaleType="matrix" android:adjustViewBounds="true" android:minHeight="100.0dip" />
<ImageView android:id="@id/imageWatermark" android:visibility="invisible" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/watermark" android:layout_alignParentRight="true" />
</RelativeLayout>
</LinearLayout>
<LinearLayout android:orientation="vertical" android:id="@id/mainLLauout" android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:launcher="http://schemas.android.com/apk/res/com.android.launcher">
<LinearLayout android:gravity="center_horizontal" android:orientation="horizontal" android:background="@drawable/background" android:layout_width="fill_parent" android:layout_height="50.0dip"
xmlns:android="http://schemas.android.com/apk/res/android">
<ImageButton android:padding="0.0px" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="3.0dip" android:src="@drawable/open" android:text="Select Picture" android:onClick="openGallery" />
<ImageButton android:padding="0.0px" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="3.0dip" android:src="@drawable/cat" android:text="Choose Cat" android:onClick="chooseCat" />
<ImageButton android:id="@id/btnFlip" android:padding="0.0px" android:longClickable="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="3.0dip" android:src="@drawable/rotate" android:onClick="rotateImage" />
<ImageButton android:padding="0.0px" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="3.0dip" android:src="@drawable/eraser" android:onClick="eraseImage" />
<ImageButton android:id="@id/btnSave" android:padding="0.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="3.0dip" android:src="@drawable/save" android:text="Save" android:onClick="saveToGallery" />
<ImageButton android:padding="0.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="3.0dip" android:src="@drawable/help" android:text="Save" android:onClick="openHelp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
我想这是因为“android:layout_height="370.0dip"” - 它应该更小。但是当我尝试在 Eclipse 上将其更改为“360”或“fill_parent”,签署 apk,在手机上安装并尝试打开应用程序时,它崩溃了。我错过了什么吗?我只是想让应用适合我的手机屏幕
抱歉英语不好和那个愚蠢的问题
05-16 18:21:30.796: W/dalvikvm(11715): threadid=1: thread exiting with uncaught exception (group=0x40018560)
05-16 18:21:31.306: E/AndroidRuntime(11715): FATAL EXCEPTION: main
05-16 18:21:31.306: E/AndroidRuntime(11715): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.addacat.addacat/com.addacat.addacat.AddaCatActivity}: java.lang.ClassNotFoundException: com.addacat.addacat.AddaCatActivity in loader dalvik.system.PathClassLoader[/data/app/com.addacat.addacat-2.apk]
05-16 18:21:31.306: E/AndroidRuntime(11715): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1680)
05-16 18:21:31.306: E/AndroidRuntime(11715): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1784)
05-16 18:21:31.306: E/AndroidRuntime(11715): at android.app.ActivityThread.access$1500(ActivityThread.java:123)
05-16 18:21:31.306: E/AndroidRuntime(11715): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:939)
05-16 18:21:31.306: E/AndroidRuntime(11715): at android.os.Handler.dispatchMessage(Handler.java:99)
05-16 18:21:31.306: E/AndroidRuntime(11715): at android.os.Looper.loop(Looper.java:130)
05-16 18:21:31.306: E/AndroidRuntime(11715): at android.app.ActivityThread.main(ActivityThread.java:3835)
05-16 18:21:31.306: E/AndroidRuntime(11715): at java.lang.reflect.Method.invokeNative(Native Method)
05-16 18:21:31.306: E/AndroidRuntime(11715): at java.lang.reflect.Method.invoke(Method.java:507)
05-16 18:21:31.306: E/AndroidRuntime(11715): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
05-16 18:21:31.306: E/AndroidRuntime(11715): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
05-16 18:21:31.306: E/AndroidRuntime(11715): at dalvik.system.NativeStart.main(Native Method)
05-16 18:21:31.306: E/AndroidRuntime(11715): Caused by: java.lang.ClassNotFoundException: com.addacat.addacat.AddaCatActivity in loader dalvik.system.PathClassLoader[/data/app/com.addacat.addacat-2.apk]
05-16 18:21:31.306: E/AndroidRuntime(11715): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
05-16 18:21:31.306: E/AndroidRuntime(11715): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
05-16 18:21:31.306: E/AndroidRuntime(11715): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
05-16 18:21:31.306: E/AndroidRuntime(11715): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
05-16 18:21:31.306: E/AndroidRuntime(11715): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1672)
05-16 18:21:31.306: E/AndroidRuntime(11715): ... 11 more
一个
package com.addacat.addacat;
import android.app.Activity;
import android.os.Bundle;
public class AddaCatActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// TODO Auto-generated method stub
}
}
这就是 AddaCatActivity.java 上的一切