<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.Falsewechat"
tools:targetApi="31">
<activity
android:name="fragmentOne"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
intent-filter>
<meta-data
android:name="android.app.lib_name"
android:value="" />
activity>
<activity android:name=".MainActivity"
android:exported="true">activity>
<activity android:name=".XINGXI"
android:exported="true">activity>
application>
manifest>
package com.itheima.false_wechat;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
public class fragmentOne extends Fragment {
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View v=inflater.inflate(R.layout.fragmentone,container,false);
return super.onCreateView(inflater, container, savedInstanceState);
}
}
package com.itheima.false_wechat;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Switch;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button b1,b2,b3,b4;
b1=findViewById(R.id.b1);
b2=findViewById(R.id.b2);
b3=findViewById(R.id.b3);
b4=findViewById(R.id.b4);
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent=new Intent(MainActivity.this,XINGXI.class) ;
startActivity(intent);
}
});
```xml
}
}
```java
package com.itheima.false_wechat;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
public class XINGXI extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.xingxi);
}
}
<LinearLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<Button
android:id="@+id/b1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@android:drawable/ic_dialog_email"
android:contentDescription="@string/app_name">Button>
<Button
android:id="@+id/b2"
android:background="?android:attr/actionModeFindDrawable"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">Button>
<Button
android:id="@+id/b3"
android:background="@drawable/ic_launcher_foreground"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">Button>
<Button
android:id="@+id/b4"
android:layout_width="0dp"
android:background="@android:drawable/btn_star_big_on"
android:layout_height="match_parent"
android:layout_weight="1">Button>
LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<fragment
android:layout_width="match_parent"
android:layout_gravity="bottom"
android:name="com.itheima.false_wechat.fragmentOne"
android:id="@+id/fr"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
tools:context=".MainActivity"
android:layout_height="60dp"
tools:layout="@layout/activity_main"
>
fragment>
LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
app:srcCompat="@drawable/ic_launcher_foreground" />
LinearLayout>
你哪里有一个叫fragmentOne的activity啊
看看控制台有没有报错信息