0
HorizontalScrollView
을 사용하여 TextViews
을 화면 위로 밀어냅니다. 내 질문은 이제 각각의 너비를 전화 화면의 너비와 일치시키는 방법이있는 경우 사용자가 사용하는 전화와 독립적입니다.보기의 너비를 모든 표시 크기와 같게 설정하는 방법은 무엇입니까?
장치의 디스플레이 너비를 얻은 다음 내 너비 인 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