mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2025-04-19 22:40:49 +00:00
タイトルを中央へ WIP
This commit is contained in:
parent
83806e0d90
commit
10019cb86b
@ -13,6 +13,8 @@ import androidx.navigation.ui.NavigationUI;
|
|||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.Gravity;
|
||||||
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
import com.google.android.material.bottomnavigation.BottomNavigationView;
|
||||||
@ -53,6 +55,18 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
Toolbar toolbar = findViewById(R.id.toolbar);
|
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(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);
|
DrawerLayout drawer = findViewById(R.id.drawer_layout);
|
||||||
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
|
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
|
||||||
this, drawer, toolbar, one.nem.lacerta.shared.ui.R.string.placeholder, one.nem.lacerta.shared.ui.R.string.placeholder);
|
this, drawer, toolbar, one.nem.lacerta.shared.ui.R.string.placeholder, one.nem.lacerta.shared.ui.R.string.placeholder);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user