디스플레이 상단에 작은 이미지 축소판의 가로선을 만들고 싶습니다. 그들은 쓰기 위해 왼쪽에서부터 줄을서야합니다 (모두 왼쪽으로 떠있었습니다). 미리보기 이미지를 클릭하면 더 큰 버전이이 줄 아래에 표시됩니다. 가로형 LinearLayout (ID가 galleryLayout 인 것을 참조하십시오)으로 가기로했습니다. 그것은 나중에 HorizontalScrollView 내에서 사용하기 때문에 LinearLayout이어야합니다. 여기 내 레이아웃 코드 :Android LinearLayout에서 내용을 왼쪽 정렬하지 않았습니다.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:background="#ffffef3a"
android:orientation="vertical"
tools:context=".Gallery01">
<LinearLayout
android:id="@+id/galleryLayout"
android:orientation="horizontal"
android:gravity="left"
android:layout_width="match_parent"
android:layout_height="120dp"
android:background="#ffff3e34">
<ImageView
android:src="@drawable/pic02"
android:layout_gravity="left"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<ImageView
android:id="@+id/image1"
android:scaleType="fitXY"
android:layout_width="320dp"
android:layout_height="320dp" />
</LinearLayout>
그러나 문제는 여기에서 볼 수 있듯이 이미지가 레이아웃의 중앙에 표시 될 수 있습니다 :
당신이 중력을 볼 수 있듯이 LinearLayout가 작동하지 않고 이미지가 가운데에 수평으로 표시됩니다. ImageView 자체의 중력은 잘 작동하지 않습니다 (즉, 작동시키기위한 시도입니다).
내가 뭘 잘못하고 있는지 아십니까? 도와 줘서 고마워!!