Newb 알림, 여기 뭔가 바보가되고있는 것 같습니다.RelativeLayout을 사용할 때 ListActivity 문제가 발생했습니다.
점진적으로 UI를 확장 해 왔으며 UI 중간에 ListView를 추가하고 싶습니다. Activity를 추가하고 ListActivity를 확장하기 위해 액티비티를 변경하면 Force Close가 발생합니다. 1.5 사용하기. ListView가 RelativeLayout에 내장되어 작동하지 않습니까?
감사
는public class Categories extends ListActivity{
final static String[] ITEMS = {"blah", "floop", "gnarlp", "stuff"};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.categories);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
R.layout.listrow, R.id.textview, ITEMS);
setListAdapter(adapter);
XML은 다음과 같습니다
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:id="@+id/RelativeLayout01" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android">
<ImageView
android:id="@+id/ImageView01"
android:layout_height="fill_parent" android:layout_width="fill_parent" android:scaleType="center" android:background="@drawable/background">
</ImageView>
<ImageView android:id="@+id/ImageView02" android:src="@drawable/cat_heading" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_centerHorizontal="true">
</ImageView>
<ListView android:id="@+id/ListView01" android:layout_below="@id/ImageView02" android:layout_width="wrap_content" android:layout_height="wrap_content"></ListView>
<RelativeLayout android:id="@+id/RelativeLayout02" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignBottom="@+id/RelativeLayout01" android:layout_centerHorizontal="true">
<ImageButton android:id="@+id/ImageButtonRecipes" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:src="@drawable/recipes"></ImageButton>
<ImageButton android:id="@+id/ImageButtonSearch" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_toRightOf="@+id/ImageButtonRecipes" android:src="@drawable/search"></ImageButton>
</RelativeLayout>
</RelativeLayout>
과 listrow.xml :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textview"/>
</LinearLayout>
'adb shell logcat' plz의 출력을 추가합니다 – Macarse
listrow.xml은 listrow.xml에 대한 참조로 대체 될 수 있습니다. – sargas