это не работает после выполнения проекта и очистки кода. Я получаю следующую ошибку. Попытка вызвать виртуальный метод void androidx.appcompat.app.ActionBar.setCustomView (android .view.View, androidx.appcompat.app .ActionBar $ LayoutParams) 'для нулевой ссылки на объект
final ActionBar abar = getSupportActionBar();
//line under the action bar
View viewActionBar = getLayoutInflater().inflate(R.layout.app_bar_layout, null);
ActionBar.LayoutParams params = new ActionBar.LayoutParams(//Center the textview in the ActionBar !
ActionBar.LayoutParams.WRAP_CONTENT,
ActionBar.LayoutParams.MATCH_PARENT,
Gravity.CENTER);
TextView textviewTitle = (TextView) viewActionBar.findViewById(R.id.actionbar_textview);
textviewTitle.setText("WizChat");
assert abar != null;
abar.setCustomView(viewActionBar, params);
abar.setDisplayShowCustomEnabled(true);
abar.setDisplayShowTitleEnabled(false);
abar.setDisplayHomeAsUpEnabled(true);
abar.setIcon(R.color.background_color);
abar.setHomeButtonEnabled(true);
вы можете увидеть здесь код, это мой файл манифеста, как вы просили
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.logindesign"
android:versionCode="1"
android:versionName="1.0" >
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.logindesign.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.example.logindesign.Welcome"/>
</application>
</manifest>
вы можете увидеть здесь код этого мой стиль файла, как вы просили
<resources>
<style name="AppBaseTheme" parent="@style/Theme.AppCompat.NoActionBar">
</style>
<style name="AppTheme" parent="AppBaseTheme">
</style>
</resources>