第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

android.view.InflateException:二進(jìn)制 XML 文件第 2 行:

android.view.InflateException:二進(jìn)制 XML 文件第 2 行:

陪伴而非守候 2023-05-10 15:11:21
我正在嘗試自己學(xué)習(xí) android 開發(fā),因為我試圖使用按鈕和文本視圖制作一個簡單的文本更改應(yīng)用程序,但是當(dāng)我使用 USB 在我自己的手機(jī)上運(yùn)行它時,它開始顯示,不幸的是,該應(yīng)用程序已停止。如果你不介意幫助我了解這個錯誤即將到來以及如何解決它。MainActivity.java package com.nanb.wishes;import androidx.appcompat.app.AppCompatActivity;import android.os.Bundle;import android.view.View;import android.widget.Button;import android.widget.TextView;public class MainActivity extends AppCompatActivity  {TextView txt1, txt2;Button btn;@Overrideprotected void onCreate(Bundle savedInstanceState) {    super.onCreate(savedInstanceState);    setContentView(R.layout.activity_main);    final TextView txt1 = (TextView) findViewById(R.id.txt1);    final TextView txt2 = (TextView) findViewById(R.id.txt2);    Button btn = (Button) findViewById(R.id.btn);    btn.setOnClickListener(new View.OnClickListener() {        @Override        public void onClick(View view) {            txt1.setText("Happy birthday to a special person who is bringing so much joy with her smile. I am thankful for every moment we spend together, and I wish your happiness never ends.");            txt2.setText("");        }    });    btn.setOnLongClickListener(new View.OnLongClickListener() {        @Override        public boolean onLongClick(View view) {            txt1.setText(" May this day be as sunny as your smile, and as beautiful as you are. You shine every day, but on this day you will shine the brightest. Happy Birthday");            txt2.setText("");            return true;        }    });    }}activity_main.xml<?xml version="1.0" encoding="utf-8"?><androidx.constraintlayout.widget.ConstraintLayout  xmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto"xmlns:tools="http://schemas.android.com/tools"android:id="@+id/layout"android:layout_width="match_parent"android:layout_height="match_parent"android:background="@drawable/birthday"tools:context=".MainActivity">
查看完整描述

1 回答

?
holdtom

TA貢獻(xiàn)1805條經(jīng)驗 獲得超10個贊

這是將 android 項目遷移到 androidX 項目后會出現(xiàn)的一些錯誤。

這是檢查或解決這些錯誤的一些步驟

第 1 步:-確保你在 gradle 文件中的實(shí)現(xiàn)。

第 2 步:- Android studio 自動更改所有庫實(shí)現(xiàn),并根據(jù) android X 使用它。如果不知何故未完成,則更改 .xml 文件

例子 :-

     androidx.constraintlayout.ConstraintLayout (wrong).

改成

     androidx.constraintlayout.widget.ConstraintLayout (right).

注意: -你必須添加

     android.enableJetifier=true
     android.useAndroidX=true

gradle.properties 文件中的這兩行。如果該文件不存在,則創(chuàng)建它。在遷移項目時。

現(xiàn)在,這幾乎完成了

如果在那之后也出現(xiàn)錯誤,請構(gòu)建 > 重建。或者您可以從文件菜單中選擇使緩存無效/重新啟動。

我認(rèn)為它對所有正在遷移項目的人都有幫助。


查看完整回答
反對 回復(fù) 2023-05-10
  • 1 回答
  • 0 關(guān)注
  • 155 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號