0
HorizontalScrollView
を使用して、TextViews
を画面上にスライドしています。私の質問は、それぞれRelativeLayout
の幅を電話機の幅と一致させる方法があれば、ユーザーが使用する電話機とは独立しています。どのように表示の幅を任意の表示サイズに設定するのですか?
デバイスの表示幅を取得して、それをRelativeLayout
の幅に設定するのが好きですか?それとももっと良い方法がありますか?
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="20dp"
android:layout_marginTop="20dp"
android:fillViewport="true">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="320dp"
android:layout_height="match_parent"
android:background="@android:color/holo_blue_dark">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textSize="15sp"
android:textColor="@android:color/black"
android:id="@+id/info"
android:layout_margin="5dp"
android:textAlignment="center"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/info"
android:text="0"
android:textSize="80dp"
android:layout_centerHorizontal="true"
android:id="@+id/getrunkeneLiter"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="320dp"
android:layout_height="match_parent"
android:background="@android:color/holo_green_light">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="@android:color/black"
android:layout_margin="5dp"
android:id="@+id/danke"
android:textAlignment="center"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Feedback verfassen"
android:onClick="feedback"
android:layout_below="@+id/danke"
android:layout_centerHorizontal="true"/>
</RelativeLayout>
</LinearLayout>
</HorizontalScrollView>
はねえ、ありがとうございました! relativeLayoutWidthをPointのx値に設定するにはどうすればよいですか? .-。 – user7342339
例を更新して設定部分も含めました。 –
これはちょうど天才です!あなたの助けを本当に感謝します、ありがとう! – user7342339