我有一個空指針異常的問題,我不明白爲什麼。請不要將它標記爲線程的「空指針異常以及如何修復它」,因爲該線程根本就不相關。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不會讓我複製鏈接線程中的文本。當我在控制檯時會更新。 –