mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-23 00:13:16 +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.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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user