UPDATE 2Wie kann ich meine TableLayouts auf das Zentrum ausrichten?
Die horizontalscrollview verwanzt ist, schneidet es Teil der Tabelle.
Dies ist die erste Tabelle, die Scrollview bewegt sich nicht und schneidet die erste Zelle.
Die zweite Tabelle hat Scroll aber die Grenzen sind falsch ... Scrolled max nach rechts.
Scrolled max auf der linken Seite hinterlässt einen leeren Raum.
Update 3
das genau das Layout auf ein anderes ähnliches Fragment kopiert und in die Mitte nicht ausrichten, aber die horizontalScroll funktioniert gut. Diese Zufälligkeit bringt mich um.
Die aktualisierte Layout:
<FrameLayout 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"
tools:context="acr.acr_app.MyFragment3">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/scrollView3" >
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="top|center">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/textCompresores"
android:textSize="30dp"
android:textStyle="bold"
android:typeface="sans"
android:id="@+id/textView12"
android:layout_margin="30dp"
android:stretchColumns="60dp"/>
</LinearLayout>
<Spinner
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/spinner1"
android:layout_marginBottom="10dp"
android:textStyle="bold"
android:textAlignment="center">
</Spinner>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center">
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none"
android:fillViewport="true">
<TableLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|top"
android:stretchColumns="*"
android:id="@+id/tableLayout1">
</TableLayout>
</HorizontalScrollView>
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none"
android:fillViewport="true">
<TableLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|top"
android:stretchColumns="*"
android:id="@+id/tableLayout2">
</TableLayout>
</HorizontalScrollView>
</RelativeLayout>
</LinearLayout>
</ScrollView>
Haben Sie mit _android versucht: layout_centerInParent = "true" _? – Piyush
Probieren Sie es einfach mit dem gleichen Ergebnis aus, das horizontalScrollview funktioniert auch nicht richtig. Ich benutze das gleiche Layout für 4 Tabellen und das einzige, es funktioniert nicht, es ist das erste. – Xaloju
also möchten Sie Ihre 'TableLayout' in der Mitte des Bildschirms richtig platzieren? Kann ich wissen, wie genau du willst? da Sie zwei 'TableLayout' in einem' HorizontalScrollView' haben, das in einem 'RelativeLayout' liegt ... können Sie eine Vorschau des Layouts zum besseren Verständnis zeigen ... – himanshu1496