30/09/2018, 19:05
Lỗi FATAL EXCEPTION: main trong android
Có anh chị nào làm về android xin cho em hỏi không biết là thế nào mà:
Em mới chỉ viết trong Activity các dòng
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="280dp"
android:layout_height="100dp"
android:padding="8dp"
android:text=""
android:textSize="40sp" />
<ImageButton
android:id="@+id/imageButton"
android:layout_width="80dp"
android:layout_height="100dp"
android:scaleType="centerCrop"
android:src="@drawable/xoa1" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageButton
android:layout_width="90dp"
android:layout_height="100dp"
android:scaleType="centerCrop"
android:src="@drawable/so1" />
<ImageButton
android:layout_width="90dp"
android:layout_height="100dp"
android:scaleType="centerCrop"
android:src="@drawable/so2" />
<ImageButton
android:layout_width="90dp"
android:layout_height="100dp"
android:scaleType="centerCrop"
android:src="@drawable/so3" />
<ImageButton
android:layout_width="90dp"
android:layout_height="100dp"
android:scaleType="centerCrop"
android:src="@drawable/cong" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageButton
android:layout_width="90dp"
android:layout_height="100dp"
android:scaleType="centerCrop"
android:src="@drawable/so4" />
<ImageButton
android:layout_width="90dp"
android:layout_height="100dp"
android:scaleType="centerCrop"
android:src="@drawable/so5" />
<ImageButton
android:layout_width="90dp"
android:layout_height="100dp"
android:scaleType="centerCrop"
android:src="@drawable/so6" />
<ImageButton
android:layout_width="90dp"
android:layout_height="100dp"
android:scaleType="centerCrop"
android:src="@drawable/tru" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageButton
android:layout_width="90dp"
android:layout_height="100dp"
android:scaleType="centerCrop"
android:src="@drawable/so7" />
<ImageButton
android:layout_width="90dp"
android:layout_height="100dp"
android:scaleType="centerCrop"
android:src="@drawable/so8" />
<ImageButton
android:layout_width="90dp"
android:layout_height="100dp"
android:scaleType="centerCrop"
android:src="@drawable/so9" />
<ImageButton
android:layout_width="90dp"
android:layout_height="100dp"
android:scaleType="centerCrop"
android:src="@drawable/nhan" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageButton
android:layout_width="90dp"
android:layout_height="100dp"
android:scaleType="centerCrop"
android:src="@drawable/phay" />
<ImageButton
android:layout_width="90dp"
android:layout_height="100dp"
android:scaleType="centerCrop"
android:src="@drawable/so0" />
<ImageButton
android:layout_width="90dp"
android:layout_height="100dp"
android:scaleType="centerCrop"
android:src="@drawable/bang" />
<ImageButton
android:layout_width="90dp"
android:layout_height="100dp"
android:scaleType="centerCrop"
android:src="@drawable/chia" />
</LinearLayout>
Em chưa đụng chạm gì đến bên MainActivity mà khi chạy nó lại báo lỗi ngoại lệ hàm Main ạ? bên Activity không thấy báo lỗi gì.
Anh chị nào biết xin mách em sửa với ạ :smile:
Bài liên quan
Ở trên bạn đã chép hết file XML chưa? parent layout đâu?
Hỏi để người khác debug giúp mà bạn không post câu hỏi đầy đủ cả logcat và Layout đang làm việc thì bó tay.