From 10019cb86b1a76d1e37366dfb3e064add6b9f412 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Fri, 19 Jan 2024 16:12:41 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=BF=E3=82=A4=E3=83=88=E3=83=AB=E3=82=92?= =?UTF-8?q?=E4=B8=AD=E5=A4=AE=E3=81=B8=20WIP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/one/nem/lacerta/MainActivity.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/app/src/main/java/one/nem/lacerta/MainActivity.java b/app/src/main/java/one/nem/lacerta/MainActivity.java index f415c390..c4740e15 100644 --- a/app/src/main/java/one/nem/lacerta/MainActivity.java +++ b/app/src/main/java/one/nem/lacerta/MainActivity.java @@ -13,6 +13,8 @@ import androidx.navigation.ui.NavigationUI; import android.graphics.Color; import android.os.Bundle; import android.util.Log; +import android.view.Gravity; +import android.widget.TextView; import android.widget.Toast; import com.google.android.material.bottomnavigation.BottomNavigationView; @@ -53,6 +55,18 @@ public class MainActivity extends AppCompatActivity { Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); + // Create a new TextView + TextView toolbarTitle = new TextView(this); + // Set the text and center it in the TextView + toolbarTitle.setText("App Name"); + toolbarTitle.setTextColor(Color.WHITE); + toolbarTitle.setTextSize(20); + toolbarTitle.setLayoutParams(new Toolbar.LayoutParams(Toolbar.LayoutParams.WRAP_CONTENT, + Toolbar.LayoutParams.WRAP_CONTENT, Gravity.CENTER_HORIZONTAL)); + + // Set the TextView as the title + toolbar.addView(toolbarTitle); + DrawerLayout drawer = findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, one.nem.lacerta.shared.ui.R.string.placeholder, one.nem.lacerta.shared.ui.R.string.placeholder);