Ich habe eine LinearLayout und ich möchte nur einen Text in der Mitte meiner Bildansicht, die eine Form ist.wie man eine Textansicht innerhalb von Bildansicht android zentrieren
<LinearLayout
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_height="wrap_content">
<TextView
android:id="@+id/state_area"
android:layout_width="wrap_content"
android:textColor="#F000"
android:layout_height="90dp"
android:textSize="40sp"
android:layout_marginBottom="24dp"
android:layout_gravity="center_horizontal" />
</LinearLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/shape"
android:layout_gravity="center" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:src="@drawable/shape"
android:layout_gravity="center" />
</LinearLayout>
Das Ergebnis bisher:
Verwenden FrameLayout zwei Ansichten wickeln damit –