RohanG
RohanG

Reputation: 65

Elements overlapping on top of each other

    <android.support.v7.widget.SearchView
    android:id="@+id/view1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:queryHint="Search.."
    ></android.support.v7.widget.SearchView>

<android.support.v7.widget.SearchView
    android:id="@+id/view2"
    android:layout_below="@+id/view1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    ></android.support.v7.widget.SearchView>

I have 2 search views that i need to place one below the other. I used "android:layout_below="@+id/view1" method to place the second view under the 1st view. but both views are overlapping on top of each other. Can anybody tell me a solution for this?

Upvotes: 0

Views: 98

Answers (1)

How about using LinearLayout as the rootLayout of those searchviews instead of RelativeLayout?

your code will be looked alike this:

<LinearLayout
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <android.support.v7.widget.SearchView
        android:id="@+id/view1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:queryHint="Search.."
        ></android.support.v7.widget.SearchView>

    <android.support.v7.widget.SearchView
        android:id="@+id/view2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        ></android.support.v7.widget.SearchView>

</LinearLayout>

this will make sure that the both of the search views won't overlapped

Upvotes: 1

Related Questions