Layoutfrage: Layoutelemente nach Bildschirmgröße skalierbar?

  • Antworten:3
Slarti Bartfast
  • Forum-Beiträge: 12

20.05.2017, 22:50:51 via Website

Hallo,
Meine App besteht aus 3 Framelayouts, die über einander angeordnet sind. Der Obere Part besteht aus Textviews, die nebeneinander Angeordnet sind, Das mittlere Framelayout enthält ein ImageView, das auch den Größten teil des Bildschirms einnimmt und das untere Framelayout aus Textview, Progressbar, Textview, und Progressbar, alles untereinander.
Ich hoffe ihr konntet euch ein Bild meines layouts machen. Die bilder die ich in den Imageview lade haben 830 * 550 p.
Mein Problem ist nun, dass die app auf kleinen Bildschirmen mir den unteren Teil des layouts nicht mehr anzeigt, also den letzten Textview und Progresbar.
gibt es ne Möglichkeit in AS das ganze automatisch so zu Skallieren, dass er immer alles anzeigt ?
Vielen Dank schon mal im vorraus!
Slarti :D

Antworten
swa00
  • Forum-Beiträge: 3.704

20.05.2017, 23:59:45 via Website

Hallo Slarti,

mit dem entsprechenden XML könnten wir genauer einsehen , wie du es aufgebaut hast.
So können wir nur rätseln.

Dann ergibt sich aus deiner Beschreibung leider nicht , wie du die ImageViews Scallierst und wie
die Berechnung innerhalb deines Containers realisiert wurde.
Die Wahl der Framelayouts erscheint mit eher die falsche Wahl zu sein.

Eher ein vertikaler LinearLayout-Container, ggf. genestet in einem ScrollView

https://developer.android.com/guide/topics/ui/declaring-layout.html

— geändert am 21.05.2017, 00:01:27

Liebe Grüße - Stefan
[ App - Entwicklung ]

Antworten
Slarti Bartfast
  • Forum-Beiträge: 12

21.05.2017, 00:57:21 via Website

hier ist mein xml Code:

<?xml version="1.0" encoding="utf-8"?>

android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/backround"
android:weightSum="1">

<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="31dp">

    <TextView
        android:id="@+id/textViewRound"
        android:layout_width="107dp"
        android:layout_height="match_parent"
        android:layout_gravity="right"
        android:textColor="@android:color/black"
        android:textSize="24sp"
        android:textStyle="bold" />

    <TextView
        android:id="@+id/textViewPoints"
        android:layout_width="129dp"
        android:layout_height="match_parent"
        android:textColor="@android:color/black"
        android:textSize="24sp"
        android:textStyle="bold" />

    <TextView
        android:id="@+id/textViewPunchesPerSec"
        android:layout_width="110dp"
        android:layout_height="25dp"
        android:layout_gravity="center"
        android:paddingLeft="10dp"
        android:textSize="10sp" />
</FrameLayout>

<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="400dp"
    android:layout_gravity="fill_vertical|center_horizontal"
    android:layout_marginLeft="0dp"
    android:layout_marginRight="0dp"
    android:layout_weight="0.55">

    <ImageView
        android:id="@+id/gameImageView"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</FrameLayout>

<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="80dp"
    android:layout_marginBottom="10dp">

    <TextView
        android:id="@+id/textViewTime"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="10dp"
        android:text="Time:"
        android:textStyle="bold" />

    <ProgressBar
        android:id="@+id/progressBarTime"
        style="@style/Widget.AppCompat.ProgressBar.Horizontal"
        android:layout_width="300dp"
        android:layout_height="wrap_content"
        android:layout_gravity="clip_vertical"
        android:layout_marginTop="20dp"
        android:layout_weight="0.02"
        android:paddingLeft="10dp"
        android:paddingRight="10dp" />

    <TextView
        android:id="@+id/textViewPunches"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:layout_marginLeft="10dp"
        android:layout_marginTop="10dp"
        android:text="Punches:"
        android:textStyle="bold" />

    <ProgressBar
        android:id="@+id/progressBarPunches"
        style="@style/Widget.AppCompat.ProgressBar.Horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="clip_vertical"
        android:layout_marginTop="60dp"
        android:layout_weight="0.02"
        android:paddingLeft="10dp"
        android:paddingRight="10dp" />

    <TextView
        android:id="@+id/textViewTimeCounter"
        android:layout_width="28dp"
        android:layout_height="wrap_content"
        android:layout_gravity="right"
        android:layout_marginTop="18dp" />

</FrameLayout>

Antworten
swa00
  • Forum-Beiträge: 3.704

21.05.2017, 10:08:08 via Website

Lösung = Siehe Oben

Liebe Grüße - Stefan
[ App - Entwicklung ]

Antworten