J'ai ajouté une barre de titre personnalisée en utilisant le code suivant, mais j'ai l'impression d'avoir environ 10 pixels d'espacement gauche et droite et 2px en bas, est-ce que je peux adapter la barre de titre personnalisée?La barre de titre personnalisée ne remplit pas la barre de titre
Merci pour tout conseil
Jonathan
customTitleSupported = requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.tab);
Display display = getWindowManager().getDefaultDisplay();
if (customTitleSupported) {
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,
R.layout.titlebar);
LinearLayout titlebar = (LinearLayout) findViewById(R.id.TitleBarLayOut);
titlebar.setPadding(-2, -1, -2, -1);
titlebar.setMinimumWidth(display.getWidth());
GradientDrawable grad = new GradientDrawable(Orientation.TOP_BOTTOM,
new int[] {Color.RED, Color.YELLOW}
);
titlebar.setBackgroundDrawable(grad);
playButton = new Button(this);
playButton.setText("Play");
playButton.setGravity(Gravity.LEFT);
infoButton = new Button(this);
infoButton.setText("Info");
infoButton.setGravity(Gravity.RIGHT);
titlebar.addView(playButton, new LinearLayout.LayoutParams(
70,1));
titlebar.addView(infoButton, new LinearLayout.LayoutParams(
70,1));
}
<?xml version="1.0" encoding="utf-8"?>
Désolé, je n'ai pas réalisé ma mise en page xml n'a pas posté. J'ai la largeur définie comme parent de remplissage –
Je ne sais pas alors. Essayez de supprimer le MinWidth et le remplissage? –