내가이 보이는 여기 방법, 다음 줄에 4, 5 이미지를 배치하기 위해 수행해야비정상적으로 이미지가 화면 밖으로 이동
4, 5 이미지는 어떻게 수정 화면에서 이동 ?
MainActivity :
LayoutInflater l = getLayoutInflater();
LinearLayout ll = (LinearLayout) findViewById(R.id.main);
Integer odpowiedzi[] = {R.drawable.kwiaty1, R.drawable.kwiaty2, R.drawable.kwiaty3, R.drawable.kwiaty4, R.drawable.kwiaty5};
for (Integer odp : odpowiedzi) {
View v = l.inflate(R.layout.activ2, null);
ImageView b = (ImageView) v.findViewById(R.id.imageView6);
b.setImageResource(odp);
ll.addView(v);
activ2.xml :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:id="@+id/imageView6"/>
</LinearLayout>
activity_main.xml :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/main">
</LinearLayout>
해결할 수있는 방법에는 여러 가지가 있습니다. 그러나 간단하고 자동적 인 방법으로 그것을 수행하고 그냥 감쌀 수 없습니다. 다른 레이아웃과 어댑터가 필요할 것입니다. 그러나 그것은 실제로 가지고있는 시나리오의 종류에 달려 있습니다. – xklakoux
가능한 중복의 [안드로이드 수평 LinearLayout - 요소를 래핑] (http://stackoverflow.com/questions/14528381/android-horizontal-linearlayout-wrap-elements) – xklakoux
나는 내 대답은 –