我想将ActionBar大小设置为80dp。我试过这个但是没有工作:
if (sender instanceof Player)
{
Particle particle = new Particle();
Player player = (Player) sender;
double x = ((Player) sender).getLocation().getX();
double y = ((Player) sender).getLocation().getY();
double z = ((Player) sender).getLocation().getZ();
World w = sender.getWorld();
w.spawnParticle(org.bukkit.Particle.TOTEM, x, y, z, 1, 0, 0, 0);
}
的活动:
<style name="LargeActionBar" parent="Base.Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary_dark</item>
<item name="colorAccent">@color/accent</item>
<item name="actionBarStyle">@style/LargeActionBar.Large</item>
<item name="android:actionBarStyle">@style/LargeActionBar.Large</item>
</style>
<style name="LargeActionBar.Large" parent="Base.Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="android:background">@color/primary</item>
<item name="android:height">80dp</item>
<item name="height">80dp</item>
<item name="actionBarSize">80dp</item>
</style>
我使用 @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity);
ActionBar actionBar = getSupportActionBar();
setTheme(R.style.LargeActionBar);
actionBar.setDisplayShowHomeEnabled(false);
actionBar.setDisplayShowTitleEnabled(false);
LayoutInflater inflater = LayoutInflater.from(this);
View customView = inflater.inflate(R.layout.layout_actionbar,null);
actionBar.setCustomView(customView);
actionBar.setDisplayShowCustomEnabled(true);
和setTheme
以两种不同的方式尝试过它。是否有可能干扰另一方?