I am trying to set a RecyclerView and a GridView to take up 70% and 30% of the layout respectively. I am using a fragment for this as well.
With this xml, neither views appear on the screen:
<RelativeLayout xmlns:android="http://ift.tt/nIICcg"
xmlns:tools="http://ift.tt/LrGmb4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:elevation="5dp"
tools:context="shamak.self.eventplanner.activities.Activity_NewEvent$PlaceholderFragment">
<TextView
android:id="@+id/section_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="1">
<android.support.v7.widget.RecyclerView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.7"
tools:context=".Fragment_i"
/>
<GridView
android:id="@+id/grid_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.3"
android:numColumns="2"
android:verticalSpacing="5dp"
android:horizontalSpacing="5dp"
>
</GridView>
</LinearLayout>
</RelativeLayout>
With the layout_height
of the RecyclerView set to match_parent
instead, the RecyclerView populates the entire screen:
<android.support.v7.widget.RecyclerView
android:id="@+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Fragment_i"
/>
No comments:
Post a Comment