【问题标题】:The application has stopped unexpectedly FrameLayout + ImageView应用程序意外停止 FrameLayout + ImageView
【发布时间】:2015-07-03 04:26:11
【问题描述】:

我正在尝试使用 ImageView 练习 FrameLayout。当我构建代码时,它没有任何问题。但是当我尝试使用 AVD Android 2.2 运行它时,程序将无法运行。

它说“应用程序框架布局(process.com.framelayout)已意外停止。请重试”

这是我的代码:

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="fill_parent"
    android:layout_width="fill_parent"
    android:background="#FFFFFF"
    >
<TableRow>
<FrameLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    >
<ImageView
    android:src = "@drawable/pict01" 
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    />
</FrameLayout>
<FrameLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    >
<ImageView
    android:src = "@drawable/pict02"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    />
</FrameLayout>
</TableRow>

<TableRow>
<FrameLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    >
<ImageView
    android:src = "@drawable/pict03"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    />
</FrameLayout>
<FrameLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    >
<ImageView
    android:src = "@drawable/pict04"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    />
</FrameLayout>
</TableRow>
</TableLayout>

【问题讨论】:

  • 请发布完整的堆栈跟踪。
  • 同时展示你的 JAVA 类。
  • 在哪里可以找到?对不起,我是 android 的新手
  • 你的课程代码和你的 logcat。
  • 你的意思是framelayout.java的类代码吗?我在哪里可以找到我的 logcat?我正在使用 netbeans IDE 8.0.2。对不起,非常基本的问题

标签: android imageview android-framelayout


【解决方案1】:

试试这个得到错误信息:

 @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        try
        {
        setContentView(R.layout.main);
        }
        catch(Exception e)
         {
            AlertDialog.Builder dialog = new AlertDialog.Builder(this);
             dialog.setTitle("error message");

            dialog.setMessage(Log.getStackTraceString(e));

            dialog.create().show();
         }
    }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-06-14
    • 2013-08-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多