Я использую GridView
в своем приложении для Android. Все работает отлично на моем телефоне, но когда я попытался запустить приложение на эмуляторе планшета, он разбился с самого начала.Ошибка раздувания GridView на планшете
Ошибка E/AndroidRuntime(466): java.lang.RuntimeException: Unable to start activity ComponentInfo{****/***.Main}: java.lang.RuntimeException: Unable to start activity ComponentInfo{***/***.views.calendar.CalendarView}: android.view.InflateException: Binary XML file line #42: Error inflating class android.widget.GridView
В строке # 42 есть только тег <GridView>
.
Тогда StackTrace говорит Caused by: android.view.InflateException: Binary XML file line #42: Error inflating class android.widget.GridView
, Caused by: java.lang.reflect.InvocationTargetException
и заканчивается:
02-11 23:57:17.079: E/AndroidRuntime(466): Caused by: android.content.res.Resources$NotFoundException: File from drawable resource ID #0x1020004
02-11 23:57:17.079: E/AndroidRuntime(466): at android.content.res.Resources.loadDrawable(Resources.java:1874)
02-11 23:57:17.079: E/AndroidRuntime(466): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
02-11 23:57:17.079: E/AndroidRuntime(466): at android.widget.AbsListView.<init>(AbsListView.java:711)
02-11 23:57:17.079: E/AndroidRuntime(466): at android.widget.GridView.<init>(GridView.java:76)
02-11 23:57:17.079: E/AndroidRuntime(466): at android.widget.GridView.<init>(GridView.java:72)
Я не использую никаких LayoutParams, мой макет XML выглядит следующим образом:
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/calendar_relativeLayout_main"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<RelativeLayout
android:id="@+id/calendar_relativeLayout_infoBar"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:background="@color/calendar_infoBar_background" >
<ImageButton
android:id="@+id/calendar_imageButton_previousMonth"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentLeft="true"
android:background="@null"
android:src="@drawable/ic_calendar_prev" />
<ImageButton
android:id="@+id/calendar_imageButton_nextMonth"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:background="@null"
android:src="@drawable/ic_calendar_next" />
<TextView
android:id="@+id/calendar_textView_currentMonth"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="February 2012"
android:textSize="17dp" />
</RelativeLayout>
<GridView
android:id="@+id/calendar_gridView_currentCalendar"
android:layout_width="fill_parent"
android:layout_height="240dp"
android:layout_below="@+id/calendar_relativeLayout_infoBar"
android:numColumns="7"
android:isScrollContainer="false"
android:listSelector="@android:id/empty">
</GridView>
</RelativeLayout>
То, что я не понимаю заключается в следующем: GridView
работает на телефоне и не работает в планшете ...
Заранее благодарен за любые подсказки ...
Это сработало! Я изменился на цвет, и это сработало! Огромное спасибо!!! Я так счастлив сейчас. – lomza