Ich arbeite an einer App, wo ich eine Fortschrittsleiste und eine Textansicht haben möchte. Und die Sache ist, dass die Textansicht einen anderen Hintergrund haben sollte. Wenn ich android:layout_width="match_parent"
verwende, bleibt Platz an den Seiten der Textansicht. Wenn wir einen weißen Hintergrund haben, ist es in Ordnung, aber wenn wir einen anderen Hintergrund verwenden, sieht es nicht gut aus. Wie kann ich das erreichen?Wie wird ein TextView hinzugefügt, das die volle Breite des Layouts des Telefons einnimmt?
Kurz gesagt, bekomme ich die folgende Ansicht (erstes Bild), wenn ich setze, aber ich möchte, dass die Seite wie die im zweiten Bild aussieht.
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="senti.com.freelaneprogress.MainActivity">
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="300dp"
android:layout_height="300dp"
android:layout_centerInParent="true"
android:max="100"
android:progress="40"
android:rotation="270"
android:progressDrawable="@drawable/circular"/>
<TextView
android:id="@+id/eta"
android:background="#00000000"
android:layout_height="100dp"
android:layout_width="150dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="1.3in"/>
<TextView
android:layout_width="150dp"
android:layout_height="50dp"
android:layout_marginTop="2in"
android:layout_centerHorizontal="true"/>
<TextView
android:background="@drawable/textviewbg"
android:layout_width="match_parent"
android:layout_height="30pt"
android:contextClickable="false"
android:layout_alignParentBottom="true"
android:id="@+id/textView" />
</RelativeLayout>
löschen Polsterung bilden den Hauptbehälter (RelativeLayout), dass die IDE fügt hinzu, wenn Sie die Aktivität erstellen – MikeKeepsOnShine