Ich benutze Actionbar und Anzeige einiger Titel und Untertitel der Aktionsleiste. Ich möchte, dass die Untertitelgröße kleiner als der Titel ist. Und ich habe auch ein Logo-Symbol in der linken Seite. Wie sollte ich die Ausrichtung anpassen?Actionbar Titel und Untertitel Ausrichtung und textSize in Fragmenten
Es gibt ein weiteres Fragment, in dem ich den Zurück-Button als Home-Button verwende. Daher möchte ich auch den Abstand zwischen der Zurück-Schaltfläche und dem Titel der Aktionsleiste reduzieren.
Ich habe versucht, diesen Code zu verwenden. Aber es hat nicht geholfen.
UserListFragment.java
View viewActionBar = getActivity().getLayoutInflater().inflate(R.layout.actionbar_layout, null);
ActionBar.LayoutParams params = new ActionBar.LayoutParams(ActionBar.LayoutParams.WRAP_CONTENT,ActionBar.LayoutParams.MATCH_PARENT,Gravity.CENTER);
TextView textviewTitle = (TextView) viewActionBar.findViewById(R.id.mytext);
textviewTitle.setText("DemoIosAppDoctor"+"\n"+"Doctor");
actionBar.setCustomView(viewActionBar, params);
actionBar.setDisplayShowCustomEnabled(true);
actionBar.setDisplayShowTitleEnabled(false);
}
actionbar_layout.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffffff"
android:id="@+id/mytext"
android:textSize="18sp"
android:layout_marginTop="5dp"
android:layout_marginLeft="-2dp"/>
</LinearLayout>
Können Sie bitte einmal den XML-Code post.? – Rider
ja, ich habe meine Antwort bearbeitet –
Es gibt Fehler in setSupportActionBar und findViewById – Rider