Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -----------------------------------
- | |
- | A B |
- | |
- -----------------------------------
- -----------------------------------
- | |
- | AB |
- | |
- -----------------------------------
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:oriantion="horizontal"
- android:weightSum="2">
- <Button
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="1" />
- <Button
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="3" />
- </LinearLayout>
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:weightSum="1"
- android:orientation="horizontal">
- <ImageView
- android:id="@+id/image1"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:src="@mipmap/ic_launcher"
- android:layout_weight=".5" />
- <ImageView
- android:id="@+id/image2"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:src="@mipmap/ic_launcher"
- android:layout_weight=".5" />
- </LinearLayout>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:gravity="center"
- >
- <ImageView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:src="@mipmap/ic_launcher"/>
- <ImageView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginLeft="50dp"
- android:src="@mipmap/ic_launcher"/>
- </LinearLayout>
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal">
- <ImageView
- android:id="@+id/image1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- />
- <ImageView
- android:id="@+id/image2"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- />
- </LinearLayout>
- <LinearLayout
- android:id="@+id/servicesLinearLayout"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:gravity="center_horizontal"
- android:orientation="horizontal">
- </LinearLayout>
- LinearLayout yourLinearLayout = (LinearLayout) findViewById(R.id.yourLinearLayout);
- LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
- LinearLayout.LayoutParams.WRAP_CONTENT,
- LinearLayout.LayoutParams.WRAP_CONTENT
- );
- for (int i = 0; i < imagesToAdd.size(); i++) {
- ImageView imgView = new ImageView(this);
- imgView.setImageResource("yourResourceID" + i);
- imgView.setLayoutParams(layoutParams);
- yourLinearLayout.addView(imgView);
- }
Add Comment
Please, Sign In to add comment