将纵向更改为横向时出错

时间:2013-08-26 17:49:49

标签: android rotation

当我使用我的Android应用程序时,当我将设备的位置从纵向更改为landescape或横向更改为垂直时,我得到此错误原因?

08-25 23:09:05.308: E/AndroidRuntime(1140): FATAL EXCEPTION: main
08-25 23:09:05.308: E/AndroidRuntime(1140): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.emergencycalls/com.emergencycalls.Tpost}: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
08-25 23:09:05.308: E/AndroidRuntime(1140):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
08-25 23:09:05.308: E/AndroidRuntime(1140):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
08-25 23:09:05.308: E/AndroidRuntime(1140):     at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:2832)
08-25 23:09:05.308: E/AndroidRuntime(1140):     at android.app.ActivityThread.access$1600(ActivityThread.java:117)
08-25 23:09:05.308: E/AndroidRuntime(1140):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
08-25 23:09:05.308: E/AndroidRuntime(1140):     at android.os.Handler.dispatchMessage(Handler.java:99)
08-25 23:09:05.308: E/AndroidRuntime(1140):     at android.os.Looper.loop(Looper.java:123)
08-25 23:09:05.308: E/AndroidRuntime(1140):     at android.app.ActivityThread.main(ActivityThread.java:3683)
08-25 23:09:05.308: E/AndroidRuntime(1140):     at java.lang.reflect.Method.invokeNative(Native Method)
08-25 23:09:05.308: E/AndroidRuntime(1140):     at java.lang.reflect.Method.invoke(Method.java:507)
08-25 23:09:05.308: E/AndroidRuntime(1140):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
08-25 23:09:05.308: E/AndroidRuntime(1140):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
08-25 23:09:05.308: E/AndroidRuntime(1140):     at dalvik.system.NativeStart.main(Native Method)
 08-25 23:09:05.308: E/AndroidRuntime(1140): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
08-25 23:09:05.308: E/AndroidRuntime(1140):     at android.view.LayoutInflater.createView(LayoutInflater.java:518)
08-25 23:09:05.308: E/AndroidRuntime(1140):     at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
08-25 23:09:05.308: E/AndroidRuntime(1140):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
08-25 23:09:05.308: E/AndroidRuntime(1140):     at android.view.LayoutInflater.inflate(LayoutInflater.java:386)
08-25 23:09:05.308: E/AndroidRuntime(1140):     at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
08-25 23:09:05.308: E/AndroidRuntime(1140):     at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
 08-25 23:09:05.308: E/AndroidRuntime(1140):    at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
 08-25 23:09:05.308: E/AndroidRuntime(1140):    at android.app.Activity.setContentView(Activity.java:1657)
  08-25 23:09:05.308: E/AndroidRuntime(1140):   at com.emergencycalls.Tpost.onCreate(Tpost.java:11)
 08-25 23:09:05.308: E/AndroidRuntime(1140):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
 08-25 23:09:05.308: E/AndroidRuntime(1140):    at  android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
  08-25 23:09:05.308: E/AndroidRuntime(1140):   ... 12 more
  08-25 23:09:05.308: E/AndroidRuntime(1140): Caused by: java.lang.reflect.InvocationTargetException
  08-25 23:09:05.308: E/AndroidRuntime(1140):   at java.lang.reflect.Constructor.constructNative(Native Method)
  08-25 23:09:05.308: E/AndroidRuntime(1140):   at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
  08-25 23:09:05.308: E/AndroidRuntime(1140):   at android.view.LayoutInflater.createView(LayoutInflater.java:505)
 08-25 23:09:05.308: E/AndroidRuntime(1140):    ... 22 more
  08-25 23:09:05.308: E/AndroidRuntime(1140): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
 08-25 23:09:05.308: E/AndroidRuntime(1140):    at android.graphics.Bitmap.nativeCreate(Native Method)
 08-25 23:09:05.308: E/AndroidRuntime(1140):    at android.graphics.Bitmap.createBitmap(Bitmap.java:477)
 08-25 23:09:05.308: E/AndroidRuntime(1140):    at android.graphics.Bitmap.createBitmap(Bitmap.java:444)
 08-25 23:09:05.308: E/AndroidRuntime(1140):    at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:349)
 08-25 23:09:05.308: E/AndroidRuntime(1140):    at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:498)
 08-25 23:09:05.308: E/AndroidRuntime(1140):    at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:473)
 08-25 23:09:05.308: E/AndroidRuntime(1140):    at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:336)
08-25 23:09:05.308: E/AndroidRuntime(1140):     at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
08-25 23:09:05.308: E/AndroidRuntime(1140):     at android.content.res.Resources.loadDrawable(Resources.java:1709)
08-25 23:09:05.308: E/AndroidRuntime(1140):     at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
 08-25 23:09:05.308: E/AndroidRuntime(1140):    at android.view.View.<init>(View.java:1951)
  08-25 23:09:05.308: E/AndroidRuntime(1140):   at android.view.ViewGroup.<init>(ViewGroup.java:292)
  08-25 23:09:05.308: E/AndroidRuntime(1140):   at android.widget.FrameLayout.<init>(FrameLayout.java:88)
  08-25 23:09:05.308: E/AndroidRuntime(1140):   at android.widget.ScrollView.<init>  (ScrollView.java:145)
 08-25 23:09:05.308: E/AndroidRuntime(1140):    at android.widget.ScrollView.<init>(ScrollView.java:141)
 08-25 23:09:05.308: E/AndroidRuntime(1140):    ... 25 more

它不会在应用程序开始时发生,但在使用更多并搜索应用程序后,它会发生什么意思呢?我该如何解决?

的xml:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/page_bg_center" >

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="488dp"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/textView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignRight="@+id/textView1"
        android:layout_below="@+id/textView1"
        android:layout_marginTop="15dp"
        android:text="آزمایشگاه ها"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="#FF6600"
        android:textSize="18sp" />

    <TextView
        android:id="@+id/textView4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignRight="@+id/textView3"
        android:layout_below="@+id/textView3"
        android:layout_marginTop="15dp"
        android:text="بیمارستان های دولتی"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="#FF6600"
        android:textSize="18sp" />

    <TextView
        android:id="@+id/textView5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignRight="@+id/textView4"
        android:layout_below="@+id/textView4"
        android:layout_marginTop="15dp"
        android:text="بیمارستان های خصوصی"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="#FF6600"
        android:textSize="18sp" />

    <TextView
        android:id="@+id/textView7"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignRight="@+id/textView6"
        android:layout_below="@+id/textView6"
        android:layout_marginTop="15dp"
        android:text="بانک ها"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="#FF6600"
        android:textSize="18sp" />

    <TextView
        android:id="@+id/textView6"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignRight="@+id/textView5"
        android:layout_below="@+id/textView5"
        android:layout_marginTop="15dp"
        android:text="درمانگاه ها"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="#FF6600"
        android:textSize="18sp" />

    <TextView
        android:id="@+id/textView9"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignRight="@+id/textView7"
        android:layout_below="@+id/textView7"
        android:layout_marginTop="15dp"
        android:text="ترمینال ها"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:textColor="#FF6600"
        android:textSize="18sp" />

    <TextView
        android:id="@+id/TextView01"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignRight="@+id/textView3"
        android:layout_below="@+id/textView9"
        android:layout_marginTop="15dp"
        android:layout_toLeftOf="@+id/next"
        android:text="اماکن تفریحی و زیارتی "
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="#FF6600"
        android:textSize="18sp" />

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/ruler"
        android:layout_centerHorizontal="true"
        android:text="شهرداری مناطق شیراز"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textColor="#FF6600"
        android:textSize="18sp" />

    <TextView
        android:id="@+id/textView11"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="24dp"
        android:text="شماره مکان های شیراز"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:textSize="23sp" />

    <ImageView
        android:id="@+id/ruler"
        android:layout_width="300dp"
        android:layout_height="100dp"
        android:layout_alignTop="@+id/textView11"
        android:layout_centerHorizontal="true"
        android:src="@drawable/ruler" />

    <ImageView
        android:id="@+id/imageView4"
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:layout_alignBottom="@+id/textView4"
        android:layout_alignLeft="@+id/imageView2"
        android:src="@drawable/hospital" />

    <ImageView
        android:id="@+id/imageView5"
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:layout_alignBottom="@+id/textView6"
        android:layout_alignLeft="@+id/imageView3"
        android:src="@drawable/medical" />

    <ImageView
        android:id="@+id/imageView7"
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:layout_alignBottom="@+id/textView9"
        android:layout_alignLeft="@+id/imageView6"
        android:src="@drawable/bus" />

    <ImageView
        android:id="@+id/imageView8"
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:layout_alignBottom="@+id/TextView01"
        android:layout_alignLeft="@+id/imageView7"
        android:src="@drawable/pleasure" />

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:layout_alignBottom="@+id/ruler"
        android:layout_marginLeft="10dp"
        android:layout_toRightOf="@+id/textView1"
        android:src="@drawable/shahrdari" />

    <ImageView
        android:id="@+id/imageView2"
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:layout_alignBottom="@+id/textView3"
        android:layout_alignLeft="@+id/imageView1"
        android:src="@drawable/laboratory" />

    <ImageView
        android:id="@+id/imageView3"
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:layout_alignBottom="@+id/textView5"
        android:layout_alignLeft="@+id/imageView4"
        android:src="@drawable/hospital" />

    <ImageView
        android:id="@+id/imageView6"
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:layout_alignBottom="@+id/textView7"
        android:layout_alignLeft="@+id/imageView5"
        android:src="@drawable/bank" />

    <Button
        android:id="@+id/next"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:layout_alignParentBottom="true"
        android:layout_alignRight="@+id/ruler"
        android:background="@drawable/nextbutton" />

  </RelativeLayout>

   </ScrollView>

的java:

public class Shz extends Activity {

public Shz() {
    // TODO Auto-generated constructor stub
}

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.shz);

    Button nextB = (Button) findViewById(R.id.next);
    nextB.setOnClickListener(new OnClickListener() {            
        @Override
        public void onClick(View v) {
            startActivity(new Intent(Shz.this, Shz2.class));
        }
    });

    TextView shahrdari = (TextView) findViewById(R.id.textView1);
    shahrdari.setOnClickListener(new OnClickListener() {            
        @Override
        public void onClick(View v) {
            startActivity(new Intent(Shz.this, Sshahrdari.class));
        }
    });

    TextView azmayeshgah = (TextView) findViewById(R.id.textView3);
    azmayeshgah.setOnClickListener(new OnClickListener() {          
        @Override
        public void onClick(View v) {
            startActivity(new Intent(Shz.this, Azmayeshgah.class));
        }
    });

    TextView hospital1 = (TextView) findViewById(R.id.textView4);
    hospital1.setOnClickListener(new OnClickListener() {            
        @Override
        public void onClick(View v) {
            startActivity(new Intent(Shz.this, Shospital1.class));
        }
    });

    TextView hospital2 = (TextView) findViewById(R.id.textView5);
    hospital2.setOnClickListener(new OnClickListener() {            
        @Override
        public void onClick(View v) {
            startActivity(new Intent(Shz.this, Shospital2.class));
        }
    });

    TextView medical = (TextView) findViewById(R.id.textView6);
    medical.setOnClickListener(new OnClickListener() {          
        @Override
        public void onClick(View v) {
            startActivity(new Intent(Shz.this, Smedical.class));
        }
    });

    TextView bank = (TextView) findViewById(R.id.textView7);
    bank.setOnClickListener(new OnClickListener() {         
        @Override
        public void onClick(View v) {
            startActivity(new Intent(Shz.this, Sbank.class));
        }
    });

    TextView terminal = (TextView) findViewById(R.id.textView9);
    terminal.setOnClickListener(new OnClickListener() {         
        @Override
        public void onClick(View v) {
            startActivity(new Intent(Shz.this, Terminal.class));
        }
    });

    TextView tafrih = (TextView) findViewById(R.id.TextView01);
    tafrih.setOnClickListener(new OnClickListener() {           
        @Override
        public void onClick(View v) {
            startActivity(new Intent(Shz.this, Tafrih.class));
        }
    });
}
}

0 个答案:

没有答案