Я получаю несколько отчетов об исключениях из моего приложения, вызванных RuntimeException
, генерируемым классом пользовательского интерфейса пользователя, который я использую.Вот код (кредит для этого кода идет к этому сообщению ):
public class WrapingSlidingDrawer extends SlidingDrawer {
public WrapingSlidingDrawer(Context context, AttributeSet attrs, int defStyle)
{
super(context, attrs, defStyle);
int orientation = attrs.getAttributeIntValue("android", "orientation", ORIENTATION_VERTICAL);
mTopOffset = attrs.getAttributeIntValue("android", "topOffset", 0);
mVertical = (orientation == SlidingDrawer.ORIENTATION_VERTICAL);
}
public WrapingSlidingDrawer(Context context, AttributeSet attrs)
{
super(context, attrs);
int orientation = attrs.getAttributeIntValue("android", "orientation", ORIENTATION_VERTICAL);
mTopOffset = attrs.getAttributeIntValue("android", "topOffset", 0);
mVertical = (orientation == SlidingDrawer.ORIENTATION_VERTICAL);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
int widthSpecMode = MeasureSpec.getMode(widthMeasureSpec);
int widthSpecSize = MeasureSpec.getSize(widthMeasureSpec);
int heightSpecMode = MeasureSpec.getMode(heightMeasureSpec);
int heightSpecSize = MeasureSpec.getSize(heightMeasureSpec);
if (widthSpecMode == MeasureSpec.UNSPECIFIED || heightSpecMode == MeasureSpec.UNSPECIFIED)
{
throw new RuntimeException("SlidingDrawer cannot have UNSPECIFIED dimensions");
}
, а вот формул XML, который я использую:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/customDrawerLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentBottom="true">
<com.package.WrapingSlidingDrawer
android:id="@+id/slidingDrawer"
android:handle="@+id/Handle"
android:content="@+id/contentLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
И пользовательский выдвижной ящик, и родительский элемент задают атрибуты ширины и высоты макета.Таким образом, какие-либо идеи о том, что может привести к появлению НЕУТОЧНЕННОГО?Это происходит очень редко.