der text in der Schaltfläche nicht immer vertikal zentriert im button

Erstelle ich eine Android-app, und ich habe eine Schaltfläche mit einem benutzerdefinierten hintergrund Bild dahinter. Das hintergrund Bild ist nur ein Rechteck, aber jetzt ist der button-text scheint nicht vertikal zentriert. Hier mein xml-Code für die Schaltfläche:

<Button 
android:id="@+id/save_to_list"
android:layout_below="@+id/info_pic"
android:text="SAVE TO LIST"
android:textColor="@android:color/white"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal"
android:layout_width="260dp"
android:layout_height="35dp"
android:layout_marginTop="15dp"
android:layout_marginBottom="15dp"></Button>

und ich den hintergrund hier:

ImageView button_bg = (ImageView)findViewById(R.id.button_background);
savetolist_button.setBackgroundDrawable(button_bg.getDrawable());

Ist dort, wo ändern Sie die position von text innerhalb einer Schaltfläche?

InformationsquelleAutor coder | 2011-10-27

Schreibe einen Kommentar