いくつかの写真やその他の情報を表示するシンプルな UI に取り組んでいます! 各写真をボックスに表示するための単純なレイアウトがあり、このレイアウトを動的に複数回追加したかった (私が持っている写真の数)。
これは私の info_wrapper.xml ファイルです
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/info_wrapper"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="2dp"
android:paddingBottom="2dp"
android:paddingLeft="1dp"
android:paddingRight="1dp"
>
<TextView
android:id="@+id/usernamePosting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello"/>
<ImageView
android:below="@+id/usernamePosting"
android:id="@+id/photo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello"/>
</RelativeLayout>
そして、私の main_screen.xml ファイル:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="match_parent" >
<RelativeLayout
android:id="@+id/menuBar"
android:layout_width="fill_parent"
android:layout_height="20dp"
android:background="@color/green">
<ImageView
android:id="@+id/locationIcon"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:src="@drawable/location_place"
></ImageView>
<TextView
android:id="@+id/userLocationTxtView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_toRightOf="@+id/locationIcon"
android:text="@string/app_name"
android:textColor="@color/white"
android:textSize="15dp" />
</RelativeLayout>
<RelativeLayout
android:layout_below="@id/menuBar"
android:id="@+id/bodyView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/light_gray">
</RelativeLayout>
</RelativeLayout>
今、info_wrapperビューを複数回追加しようとすると、すべてのビューが互いに重なり合っていますが、1つ下になりたいです