我有一个简单的应用程序,它显示一个表格,下面显示一个带有图像的图像视图,该图像根据在表格上单击的行而变化。它在模拟器上工作并显示正常,但是当我将它安装在我的测试手机上时它没有显示。我的代码在这里:
package com.coreservlets.widgets;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TableRow;
import com.welly.keychords.R;
public class keya extends Activity
{
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.keya);
}
public void rowClick(View view) {
ImageView imagev = (ImageView) findViewById(R.id.imageView1);
switch(view.getId()) {
case R.id.one:
imagev.setImageResource(R.drawable.achord);
break;
case R.id.two:
imagev.setImageResource(R.drawable.bminor);
break;
case R.id.three:
imagev.setImageResource(R.drawable.csharpdbminor);
break;
case R.id.four:
imagev.setImageResource(R.drawable.dchord);
break;
case R.id.five:
imagev.setImageResource(R.drawable.echord);
break;
case R.id.six:
imagev.setImageResource(R.drawable.fsharpgbminor);
break;
case R.id.seven:
imagev.setImageResource(R.drawable.gsharpdim);
break;
}
}
}
我的 xml 代码在这里:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FF909090"
android:stretchColumns="1" >
<TableRow
android:id="@+id/one"
android:onClick="rowClick">
<TextView
android:layout_margin="2dip"
android:layout_marginRight="2dip"
android:background="#0000ff"
android:padding="3dip"
android:text="I" />
<TextView
android:layout_margin="2dip"
android:layout_marginLeft="1dip"
android:background="#0000ff"
android:gravity="center"
android:padding="3dip"
android:text="A"
/>
</TableRow>
<TableRow
android:id="@+id/two"
android:onClick="rowClick">
<TextView
android:layout_column="0"
android:layout_margin="2dip"
android:background="#0000ff"
android:padding="3dip"
android:text="II" />
<TextView
android:layout_margin="2dip"
android:background="#0000ff"
android:gravity="center"
android:padding="3dip"
android:text="Bm" />
</TableRow>
<TableRow
android:id="@+id/three"
android:onClick="rowClick">
<TextView
android:layout_column="0"
android:layout_margin="2dip"
android:background="#0000ff"
android:padding="3dip"
android:text="III" />
<TextView
android:layout_margin="2dip"
android:background="#0000ff"
android:gravity="center"
android:padding="3dip"
android:text="C#m" />
</TableRow>
<View
android:layout_height="2dip"
android:background="#FF909090" />
<TableRow android:background="#0000ff" >
</TableRow>
<TableRow
android:id="@+id/four"
android:onClick="rowClick">
<TextView
android:layout_margin="2dip"
android:background="#0000ff"
android:padding="3dip"
android:text="IV" />
<TextView
android:layout_margin="2dip"
android:background="#0000ff"
android:gravity="center"
android:padding="3dip"
android:text="D" />
</TableRow>
<View
android:layout_height="2dip"
android:background="#FF909090" />
<TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</TableRow>
<TableRow
android:id="@+id/five"
android:onClick="rowClick">
<TextView
android:layout_margin="2dip"
android:layout_marginRight="2dip"
android:background="#0000ff"
android:padding="3dip"
android:text="V" />
<TextView
android:layout_margin="2dip"
android:layout_marginLeft="1dip"
android:background="#0000ff"
android:gravity="center"
android:padding="3dip"
android:text="E" />
</TableRow>
<TableRow
android:id="@+id/six"
android:onClick="rowClick">
<TextView
android:layout_margin="2dip"
android:layout_marginRight="2dip"
android:background="#0000ff"
android:padding="3dip"
android:text="VI" />
<TextView
android:layout_margin="2dip"
android:layout_marginLeft="1dip"
android:background="#0000ff"
android:gravity="center"
android:padding="3dip"
android:text="F#m" />
</TableRow>
<TableRow
android:id="@+id/seven"
android:onClick="rowClick">
<TextView
android:layout_margin="2dip"
android:layout_marginRight="2dip"
android:background="#0000ff"
android:padding="3dip"
android:text="VII" />
<TextView
android:layout_margin="2dip"
android:layout_marginLeft="1dip"
android:background="#0000ff"
android:gravity="center"
android:padding="3dip"
android:text="G#dim" />
</TableRow>
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="114dp"
android:background="#000000"
android:maxLines="10"
android:text="The relative minor of the Major key of A is F#m. The 12 bar blues progression in A is: \n A | A | A | A | D | D | A | A | E | D | A | E" />
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="#ffffff" />
</TableLayout>
imageview 的代码就在 xml 布局的底部。关于如何调试它的任何帮助?