HighLife
HighLife

Reputation: 4344

Space between scrollviews in relative layout

What is the best way to add space between two ScrollViews in a relative layout, and could you give me an example? I've been trying to use padding with little luck.

Upvotes: 0

Views: 927

Answers (2)

Sunil Kumar Sahoo
Sunil Kumar Sahoo

Reputation: 53667

Use android:layout_below="@+id/ScrollView01" in second listview to set its position to the below of first scroll view. also set android:layout_marginTop="50dip" to the second scroll view to give some margin between first scrollview and second scrollview

Try the following code

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#ffffff">
    <ScrollView

        android:id="@+id/ScrollView01"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:background="#000000">
        <RadioGroup
            android:id="@+id/RadioGroup01"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">
            <RadioButton
                android:id="@+id/RadioButton01"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Radio Button....." />

        </RadioGroup>
    </ScrollView>
    <ScrollView

        android:id="@+id/ScrollView02"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:background="#000000"
        android:layout_below="@+id/ScrollView01"
        android:layout_marginTop="50dip">

        <RadioGroup
            android:id="@+id/RadioGroup01"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">
            <RadioButton
                android:id="@+id/RadioButton02"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Radio Button....." />
        </RadioGroup>
    </ScrollView>

</RelativeLayout>

Thanks Deepak

Upvotes: 1

Matt
Matt

Reputation: 5704

Maybe try using margin instead of padding? I'm not 100% sure if that will fix your problem, but it's worth a shot.

Upvotes: 2

Related Questions