我是新來的發展,所以我不知道如果我這樣做是正確 我剛剛下載從市場的應用程序,它不適合我的屏幕(LDPI 240×320)在高度上...底部的一些按鈕不會出現。 所以我用Google搜索一些信息,並想盡一切...... 這裏是佈局/ main.xml中Android應用的屏幕尺寸不適合裝置
<?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>
我想這是因爲「機器人: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
您可以使用模擬器來測試您的應用程序。無需每次都簽名並安裝在手機上。 –
您應該啓用從misc調試安裝。使用手機的設置來源,然後直接在手機上運行/調試應用程序。觀看logcat輸出,它肯定會詳細說明您正在處理的問題的來源。 – rekaszeru
謝謝...它有很多幫助,但有一些錯誤,我不知道如何解決它們...大聲笑...我只是想改變屏幕尺寸 –