我有一个空指针异常的问题,我不明白为什么。请不要将它标记为线程的“空指针异常以及如何修复它”,因为该线程根本就不相关。Android布局xml导致n
我知道猿是什么。因此,我不需要解释。
因此,这个问题:
我有一个自定义布局
布局XML文件包含一个内部有一个tablelayout一个的LinearLayout对话框。当我完全移除桌面布局时,猿会消失。因此,我得出结论,它必须在XML中出现问题。
但是,Android studio没有提供任何错误。
这里是有问题的XML的链接:
编辑:
以下是完整的XML代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:weightSum="1">
<TextView
android:layout_width="match_parent"
android:layout_height="25dp"
android:text="Alarm info"
android:id="@+id/alarm_fragment_dialog_title"
android:textSize="20dp"
android:textColor="#000"
android:textAlignment="center" />
<TableLayout
android:layout_width="match_parent"
android:layout_height="376dp"
android:layout_marginTop="15dp"
android:layout_gravity="center_horizontal">
<TableRow android:layout_marginTop="5dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_column="1"
android:text="Enhetens navn:"
android:textColor="#000"
android:layout_weight="3"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<TextView
android:text="Ctrl-O"
android:textColor="#000"
android:layout_weight="5"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</TableRow>
<TableRow android:layout_marginTop="5dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_column="1"
android:text="Tidspunkt:"
android:textColor="#000"
android:layout_weight="3"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<TextView
android:text="Ctrl-O"
android:textColor="#000"
android:layout_weight="5"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</TableRow>
<TableRow android:layout_marginTop="5dp"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_column="1"
android:text="Posisjon:"
android:textColor="#000"
android:layout_weight="3"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<TextView
android:text="Ctrl-O"
android:textColor="#000"
android:layout_weight="5"
android:layout_width="match_parent" />
</TableRow>
</TableLayout>
<EditText
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
编辑2:添加Java代码
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
Dialog dialog = new Dialog(getContext());
dialog.setContentView(R.layout.alarm_details_dialog);
dialog.show();
}
也许共享您的XML太多,如果你觉得导致问题。 – Shaishav
从手机发帖,但我可以尝试从我的其他线程复制。秒 –
我会在稍后的帖子中发帖。我的愚蠢Iphone不会让我复制链接线程中的文本。当我在控制台时会更新。 –