This commit is contained in:
ろむねこ 2024-01-19 16:53:15 +09:00
parent 52d2a244a0
commit 74d1011412
No known key found for this signature in database
GPG Key ID: FA1F39A1BA37D168

View File

@ -68,17 +68,14 @@ public class MainActivity extends AppCompatActivity {
// // Set the TextView as the title // // Set the TextView as the title
// toolbar.addView(toolbarTitle); // toolbar.addView(toolbarTitle);
// Create a ShapeAppearanceModel with rounded corners float radius = getResources().getDimension(one.nem.lacerta.shared.ui.R.dimen.toolbar_corner_radius);
ShapeAppearanceModel shapeAppearanceModel = new ShapeAppearanceModel()
MaterialShapeDrawable materialShapeDrawable = (MaterialShapeDrawable)toolbar.getBackground();
materialShapeDrawable.setShapeAppearanceModel(materialShapeDrawable.getShapeAppearanceModel()
.toBuilder() .toBuilder()
.setAllCorners(CornerFamily.ROUNDED, getResources().getDimension(one.nem.lacerta.shared.ui.R.dimen.toolbar_corner_radius)) .setAllCorners(CornerFamily.ROUNDED,radius)
.build(); .build());
// Create a MaterialShapeDrawable with the ShapeAppearanceModel
MaterialShapeDrawable shapeDrawable = new MaterialShapeDrawable(shapeAppearanceModel);
// Set the MaterialShapeDrawable as the background of the Toolbar // Set the MaterialShapeDrawable as the background of the Toolbar
toolbar.setBackground(shapeDrawable);
DrawerLayout drawer = findViewById(R.id.drawer_layout); DrawerLayout drawer = findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(