I'm having trouble placing an Adview below a RecyclerView. Currently the RecyclerView is taking up the rest of the layout and the Adview isn't being shown. None of the solutions I have found online have solved my issue. Usually layout_weight or layout_below solves the problem but it isn't in this case.
XML
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:ads="http://schemas.android.com/apk/res-auto"
tools:context=".MainActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#7c7c7c"
android:focusable="true"
android:focusableInTouchMode="true">
<android.support.v7.widget.RecyclerView
android:id="#+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/relContainer"
android:background="#drawable/bordershadow2"
android:paddingBottom="17dp"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="10dp" />
<com.google.android.gms.ads.AdView
android:id="#+id/adView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/recycler_view"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-3940256099942544/6300978111">
</com.google.android.gms.ads.AdView>
<RelativeLayout
android:id="#+id/relContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/bordershadow"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin">
<TableLayout
android:id="#+id/purchaseTableLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="7dp"
android:paddingTop="7dp"
android:layout_alignParentTop="true"
android:stretchColumns="0,1,2">
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:weightSum="3">
<TextView
android:id="#+id/textView1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:paddingLeft="2dp"
android:singleLine="true"
android:textColor="#000"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:id="#+id/textView2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:paddingLeft="2dp"
android:singleLine="true"
android:textColor="#000"
android:textSize="24sp"
android:textStyle="bold" />
<Spinner
android:id="#+id/typeSpinner"
style="style/Theme.Material"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:entries="#array/type_array"
android:textSize="#dimen/title_size" />
</TableRow>
</TableLayout>
<EditText
android:id="#+id/searchEditText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="#+id/purchaseTableLayout"
android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'() "
android:hint="Search"
android:imeOptions="actionDone"
android:singleLine="true" />
<TableLayout
android:id="#+id/tableLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/searchEditText"
android:paddingBottom="7dp"
android:paddingTop="7dp"
android:stretchColumns="0,1,2">
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:weightSum="3.0">
<Spinner
android:id="#+id/sortRaceSpinner"
style="style/Theme.Material"
android:paddingTop="5dp"
android:paddingBottom="10dp"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.0"
android:entries="#array/sort_race_array"
android:textSize="#dimen/title_size" />
<Spinner
android:id="#+id/sortAffinitySpinner"
style="style/Theme.Material"
android:paddingTop="5dp"
android:paddingBottom="10dp"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.0"
android:entries="#array/sort_affinity_array"
android:textSize="#dimen/title_size" />
<Spinner
android:id="#+id/sortSpinner"
style="style/Theme.Material"
android:paddingTop="5dp"
android:paddingBottom="10dp"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.0"
android:entries="#array/sort_array"
android:textSize="#dimen/title_size" />
</TableRow>
</TableLayout>
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
I had a view that needed to be under a recycler view with dynamic size.
meaning that the view supposes to move down as the RecyclerView grew.
my solution was to add paddingBottom to the RecyclerView and then negative marginTop in the same value to the view, it worked perfectly.
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:paddingBottom="48dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<TextView
android:layout_marginTop="-48dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
I rewrote your layout file, The recycleview is wrapped inside a linearlayout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/wrapper"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="12dp"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="#+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:paddingBottom="20dp"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="10dp" />
</LinearLayout>
<com.google.android.gms.ads.AdView
android:id="#+id/adView"
android:layout_width="match_parent"
android:background="#000000"
android:layout_height="60dp"
android:layout_below="#+id/wrapper"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-3940256099942544/6300978111">
</com.google.android.gms.ads.AdView>
<RelativeLayout
android:id="#+id/relContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/adView"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin">
<TableLayout
android:id="#+id/purchaseTableLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="7dp"
android:paddingTop="7dp"
android:layout_alignParentTop="true"
android:stretchColumns="0,1,2">
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:weightSum="3">
<TextView
android:id="#+id/textView1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:paddingLeft="2dp"
android:singleLine="true"
android:textColor="#000"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:id="#+id/textView2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:paddingLeft="2dp"
android:singleLine="true"
android:textColor="#000"
android:textSize="24sp"
android:textStyle="bold" />
<Spinner
android:id="#+id/typeSpinner"
style="style/Theme.Material"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical" />
</TableRow>
</TableLayout>
<EditText
android:id="#+id/searchEditText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="#+id/purchaseTableLayout"
android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'() "
android:hint="Search"
android:imeOptions="actionDone"
android:singleLine="true" />
<TableLayout
android:id="#+id/tableLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/searchEditText"
android:paddingBottom="7dp"
android:paddingTop="7dp"
android:stretchColumns="0,1,2">
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:weightSum="3.0">
<Spinner
android:id="#+id/sortRaceSpinner"
style="style/Theme.Material"
android:paddingTop="5dp"
android:paddingBottom="10dp"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.0"/>
<Spinner
android:id="#+id/sortAffinitySpinner"
style="style/Theme.Material"
android:paddingTop="5dp"
android:paddingBottom="10dp"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.0"/>
<Spinner
android:id="#+id/sortSpinner"
style="style/Theme.Material"
android:paddingTop="5dp"
android:paddingBottom="10dp"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.0" />
</TableRow>
</TableLayout>
</RelativeLayout>
The result is as show
If your recycleview content will extend beyond the display height then you should consider dividing your layout into partitions with android:layout_weight.
Update
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="#+id/relContainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin">
<TableLayout
android:id="#+id/purchaseTableLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="7dp"
android:paddingTop="7dp"
android:layout_alignParentTop="true"
android:stretchColumns="0,1,2">
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:weightSum="3">
<TextView
android:id="#+id/textView1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:paddingLeft="2dp"
android:singleLine="true"
android:textColor="#000"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:id="#+id/textView2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical"
android:paddingLeft="2dp"
android:singleLine="true"
android:textColor="#000"
android:textSize="24sp"
android:textStyle="bold" />
<Spinner
android:id="#+id/typeSpinner"
style="style/Theme.Material"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_vertical" />
</TableRow>
</TableLayout>
<EditText
android:id="#+id/searchEditText"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="#+id/purchaseTableLayout"
android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'() "
android:hint="Search"
android:imeOptions="actionDone"
android:singleLine="true" />
<TableLayout
android:id="#+id/tableLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/searchEditText"
android:paddingBottom="7dp"
android:paddingTop="7dp"
android:stretchColumns="0,1,2">
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:weightSum="3.0">
<Spinner
android:id="#+id/sortRaceSpinner"
style="style/Theme.Material"
android:paddingTop="5dp"
android:paddingBottom="10dp"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.0"/>
<Spinner
android:id="#+id/sortAffinitySpinner"
style="style/Theme.Material"
android:paddingTop="5dp"
android:paddingBottom="10dp"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.0"/>
<Spinner
android:id="#+id/sortSpinner"
style="style/Theme.Material"
android:paddingTop="5dp"
android:paddingBottom="10dp"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.0" />
</TableRow>
</TableLayout>
</RelativeLayout>
<LinearLayout
android:id="#+id/wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/relContainer"
android:background="#color/colorPrimary"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="#+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp" />
</LinearLayout>
<LinearLayout
android:id="#+id/wrappers"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
android:orientation="vertical">
<com.google.android.gms.ads.AdView
android:id="#+id/adView"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-3940256099942544/6300978111">
</com.google.android.gms.ads.AdView>
</LinearLayout>
Try adding the android:clipToPadding="false" attribute to your RecyclerView.
The official documentation says, about clipToPadding:
Sets whether this ViewGroup will clip its children to its padding and
resize (but not clip) any EdgeEffect to the padded region, if padding
is present.
By default, children are clipped to the padding of their parent
ViewGroup. This clipping behavior is only enabled if padding is
non-zero.
Your XML layout would end up being:
layout.xml
<android.support.v7.widget.RecyclerView
android:id="#+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/relContainer"
android:background="#drawable/bordershadow2"
android:clipToPadding="false"
android:paddingBottom="20dp"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="10dp" />
You can do it other way, put the Adview on the recycler at the bottom and then in the adapter add an empty ViewHolder which will be always your last element, you can use for it an empty layout with the height of Adview.
Related
I have a RelativeLayout with a LinearLayout inside it which should stick to the bottom of the screen. I have added the android:layout_alignParentBottom="true" property to it, and this works fine in the emulator, but on a real device this LinearLayout falls partially outside of the screen (I can only see the ImageViews but not the TextViews).
Screenshot from emulator
Screenshot from device
This is the full XML layout file:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context="com.test.app.MainActivity"
>
<android.support.v4.view.ViewPager
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/cityTextView"
android:fontFamily="sans-serif-medium"
android:textSize="25sp"
android:textColor="#37404d"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/summaryTextView"
android:fontFamily="sans-serif-light"
android:textSize="18sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/detailsView"
android:fontFamily="sans-serif-light"
android:textSize="60sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Not bad"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"/>
<ImageView
android:id="#+id/mainImageView"
android:layout_width="230dp"
android:layout_height="230dp"
android:layout_gravity="center"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignParentBottom="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center">
<ImageView
android:id="#+id/mainOneImageView"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:layout_marginRight="5dp"
android:src="#drawable/notbad"/>
<TextView
android:id="#+id/mainOneView"
android:fontFamily="sans-serif-light"
android:textSize="30dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Not bad" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="#+id/mainTwoImageView"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_gravity="center_vertical"
android:layout_marginRight="5dp"
android:src="#drawable/notbad"/>
<TextView
android:id="#+id/mainTwoView"
android:fontFamily="sans-serif-light"
android:textSize="30sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Not bad" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="#+id/mainThreeImageView"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:layout_marginRight="5dp"
android:src="#drawable/notbad"/>
<TextView
android:id="#+id/mainThreeView"
android:fontFamily="sans-serif-light"
android:textSize="30dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Not bad" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
That is because of the scrolling behaviour, in that case, the last items of whatever will be scrolling are out of the screen actually. I guess what you could do is add a marginBottom to the root linearlayout?
Try this one
<?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:orientation="vertical"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
>
<android.support.v4.view.ViewPager
android:id="#+id/pager"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<LinearLayout
android:id="#+id/layout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/layout2"
android:orientation="vertical">
<TextView
android:id="#+id/cityTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-medium"
android:textColor="#37404d"
android:textSize="25sp"/>
<TextView
android:id="#+id/summaryTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-light"
android:textSize="18sp"/>
<TextView
android:id="#+id/detailsView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="20dp"
android:layout_marginTop="20dp"
android:fontFamily="sans-serif-light"
android:text="Not bad"
android:textSize="60sp"/>
<ImageView
android:id="#+id/mainImageView"
android:layout_width="230dp"
android:layout_height="230dp"
android:layout_gravity="center"
android:src="#drawable/notbad"
/>
</LinearLayout>
<LinearLayout
android:id="#+id/layout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="#+id/mainOneImageView"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:layout_marginRight="5dp"
android:src="#drawable/notbad"/>
<TextView
android:id="#+id/mainOneView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-light"
android:text="Not bad"
android:textSize="30dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="#+id/mainTwoImageView"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_gravity="center_vertical"
android:layout_marginRight="5dp"
android:src="#drawable/notbad"/>
<TextView
android:id="#+id/mainTwoView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-light"
android:text="Not bad"
android:textSize="30sp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="#+id/mainThreeImageView"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:layout_marginRight="5dp"
android:src="#drawable/notbad"/>
<TextView
android:id="#+id/mainThreeView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-light"
android:text="Not bad"
android:textSize="30dp"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
Scrollview in nestedScrollview is working fine with other versions of android but in kitkat it is not working.
I have addded onItemClick() function to nestedscrollview. while clicking on nested scrollview only scrollview(parent) working.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:padding="10dp"
>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/parentScrollview"
android:nestedScrollingEnabled="true"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/relative1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/navyBlue"
android:orientation="horizontal">
<ImageView
android:id="#+id/remarksLogo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="#dimen/header_left_padding_size"
android:src="#drawable/ic_action_remarks_report_white"/>
<TextView
android:id="#+id/remarksTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="#id/remarksLogo"
android:textColor="#color/white"
android:layout_marginRight="10dp"
android:gravity="center"
android:textSize="#dimen/header_text_size"
android:text=""
android:textStyle="bold"/>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingBottom="0dp"
android:paddingTop="10dp"
android:weightSum="6">
<TextView
android:id="#+id/datedTitles"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.5"
android:textAlignment="center"
android:padding="5dp"
android:background="#color/navyBlue"
android:textColor="#color/white"
android:paddingLeft="5dp"
android:textSize="#dimen/sub_header_text_size"
android:text=""/>
<TextView
android:id="#+id/fromTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.5"
android:padding="5dp"
android:background="#drawable/left_right_border_white"
android:textColor="#color/white"
android:paddingLeft="5dp"
android:textSize="#dimen/sub_header_text_size"
android:text=""/>
<TextView
android:id="#+id/detailsTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:padding="5dp"
android:background="#color/navyBlue"
android:textColor="#color/white"
android:paddingLeft="5dp"
android:textSize="#dimen/sub_header_text_size"
android:text=""/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="180dp"
android:orientation="vertical"
android:layout_marginBottom="20dp">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:isScrollContainer="true"
android:id="#+id/childNestedScrollView"
android:scrollbarAlwaysDrawVerticalTrack="true"
android:scrollbars="vertical"
android:fadeScrollbars="false"
android:nestedScrollingEnabled="true"
android:fillViewport="true">
<com.iflytechsoft.studentsuccess.utils.studentsuccessutils.ListViewForEmbeddingInScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/remarksListView"
android:choiceMode="singleChoice"
android:background="#drawable/background_white_border_navyblue"
android:layout_marginBottom="20dp"
/>
</android.support.v4.widget.NestedScrollView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingBottom="0dp"
android:id="#+id/announcementDetailLayout"
android:visibility="gone"
android:background="#color/navyBlue"
android:weightSum="6">
<TextView
android:id="#+id/dated"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1.5"
android:gravity="center"
android:background="#color/navyBlue"
android:textColor="#color/white"
android:paddingLeft="5dp"
android:textSize="#dimen/sub_header_text_size"
android:text=""/>
<TextView
android:id="#+id/from"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="#drawable/left_right_border_white"
android:textColor="#color/white"
android:paddingLeft="5dp"
android:textSize="#dimen/sub_header_text_size"
android:text=""/>
<TextView
android:id="#+id/subject"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3.7"
android:background="#color/navyBlue"
android:textColor="#color/white"
android:paddingLeft="5dp"
android:textSize="#dimen/sub_header_text_size"
android:text=""/>
</LinearLayout>
<ir.noghteh.JustifiedTextView xmlns:noghteh="http://noghteh.ir"
android:id="#+id/details"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:paddingLeft="5dp"
noghteh:textSize="#dimen/sub_header_text_size"
android:background="#drawable/background_white_border_navyblue"
/>
</LinearLayout>
</ScrollView>
</LinearLayout>
'My Topic' text is displayed in centre at the top. And below that there is a list.
I want to display a '<Back' text at the left most position on the same line as 'My Topic'. How can i achieve this?
Here is the relevant layout XML:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="0dp"
android:background="#FFFFFF"
android:orientation="vertical"
android:paddingLeft="0dp" >
<TextView
android:id="#+id/topic"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:text="My Topic"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold"
android:fontFamily="sans-serif" />
<ListView
android:id="#+id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/topic"
android:layout_margin="0dp"
android:paddingLeft="0dp"
android:divider="#A2B0B0"
android:dividerHeight="0.5dp"
android:choiceMode="singleChoice" >
</ListView>
</RelativeLayout>
replace your layout with this
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="0dp"
android:background="#FFFFFF"
android:orientation="vertical"
android:paddingLeft="0dp" >
<RelativeLayout android:id="#+id/relTopic"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/topic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_centerHorizontal="true"
android:text="My Topic"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold"
android:fontFamily="sans-serif" />
<TextView
android:id="#+id/back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_alignParentLeft="true"
android:text="Back"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold"
android:fontFamily="sans-serif" />
</RelativeLayout>
<ListView
android:id="#+id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/relTopic"
android:layout_margin="0dp"
android:paddingLeft="0dp"
android:divider="#A2B0B0"
android:dividerHeight="0.5dp"
android:choiceMode="singleChoice" >
</ListView>
</RelativeLayout>
You can take both textview in single layout and then give its reference to listview android:layout_below="#id/relTopic"
Add Relative layout above listview and put back button align to left and my topics text layout_widht="match parent" with gravity center
Here is layout code
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/mainLayout"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="< Back" />
<TextView
android:id="#+id/topic"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="My Topic"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold"
android:layout_centerVertical="true"
android:layout_alignParentStart="true" />
</RelativeLayout>
<ListView
android:id="#+id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/mainLayout"
android:layout_margin="0dp"
android:choiceMode="singleChoice"
android:divider="#A2B0B0"
android:dividerHeight="0.5dp"
android:paddingLeft="0dp"></ListView>
</LinearLayout>
<RelativeLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/topbar">
<TextView
android:id="#+id/back"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:text="< Back"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold"
android:fontFamily="sans-serif" />
<TextView
android:id="#+id/topic"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:text="My Topic"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold"
android:fontFamily="sans-serif" />
</RelativeLayout>
<ListView
android:id="#+id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/topbar"
android:layout_margin="0dp"
android:paddingLeft="0dp"
android:divider="#A2B0B0"
android:dividerHeight="0.5dp"
android:choiceMode="singleChoice" >
</ListView>
Below should be the way to go.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:background="#FFFFFF"
android:orientation="vertical"
android:paddingLeft="0dp">
<TextView
android:id="#+id/topic"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:fontFamily="sans-serif"
android:gravity="center_horizontal"
android:text="My Topic"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold" />
<TextView
android:id="#+id/back"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:fontFamily="sans-serif"
android:gravity="left"
android:text="< Back"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold" />
</RelativeLayout>
<ListView
android:id="#+id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/topic"
android:layout_margin="0dp"
android:choiceMode="singleChoice"
android:divider="#A2B0B0"
android:dividerHeight="0.5dp"
android:paddingLeft="0dp"></ListView>
</LinearLayout>
I hope it will help
Simply add this code above your "My Topic":
<TextView
android:id="#+id/tvBack"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:text="< Back"
android:textAppearance="?android:attr/textAppearanceMedium" />
...and set other attributes as you need.
I have this layout xml file:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".MainActivity">
<TextView
android:layout_marginTop="40dp"
android:id="#+id/emalLbl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="#string/test" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/testTxtLay"
android:layout_marginTop="10dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#id/emalLbl"
android:orientation="horizontal"
android:padding="10dp"
android:weightSum="1">
<EditText
android:id="#+id/testTxt"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:background="#drawable/edit_text_design" />
</LinearLayout>
<TextView
android:layout_marginTop="60dp"
android:id="#+id/reminderLbl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/testTxtLay"
android:layout_centerHorizontal="true"
android:text="#string/reminder" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_marginTop="10dp"
android:id="#+id/reminderTxtLay"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#id/reminderLbl"
android:orientation="horizontal"
android:padding="10dp"
android:weightSum="1">
<EditText
android:id="#+id/reminderTxt"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:lines="2"
android:background="#drawable/edit_text_design" />
</LinearLayout>
<View
android:id="#+id/spacer"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_below="#id/reminderTxtLay"
android:layout_centerHorizontal="true" />
<Button
android:layout_marginTop="200dp"
android:id="#+id/pickDateBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#id/reminderTxtLay"
android:layout_toLeftOf="#+id/spacer"
android:onClick="showDatePickerDialog"
android:text="#string/datePickerBtnTxt" />
<Button
android:id="#+id/pickTimeBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#id/pickDateBtn"
android:layout_alignParentRight="true"
android:layout_toRightOf="#+id/pickDateBtn"
android:onClick="showTimePickerDialog"
android:text="#string/pickTimeBtn" />
<View
android:id="#+id/spacerTxt"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_below="#id/reminderTxtLay"
android:layout_centerHorizontal="true" />
<EditText
android:layout_marginTop="15dp"
android:id="#+id/selectedDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#id/spacerTxt"
android:layout_below="#id/pickDateBtn"
android:layout_toLeftOf="#+id/spacerTxt" />
<EditText
android:id="#+id/selectedTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#id/selectedDate"
android:layout_below="#id/pickTimeBtn"
android:layout_toRightOf="#+id/selectedDate" />
<Button
android:id="#+id/submitBtn"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerInParent="true"
android:onClick="submitData"
android:text="#string/submitBtn" />
</RelativeLayout>
</ScrollView>
This is the custom design for 7 inch tablets, placed in res\layout-sw600dp
Anyways in the android studio landscape preview it seems just fine:
But in the emulator something is going wrong and here is how it looks strange. What I mean is that the submit button is not on the bottom and the pickDate and pickTime buttons are at the bottom of the layout.
I know that I'm missing a basic point here, but as an android developer, I'm not able to spot it.
Can you give me a push?
Here is a complete way to do what you seem to try accomplish. You don't need to create any Views for "spaces" etc. You only need to add margin or padding to either side of your views to make it move away from another view.
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin">
<LinearLayout
android:id="#+id/linear_wrapper"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center_horizontal"
>
<TextView
android:layout_marginTop="40dp"
android:id="#+id/emalLbl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/test" />
<EditText
android:id="#+id/testTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/edit_text_design" />
<TextView
android:layout_marginTop="60dp"
android:id="#+id/reminderLbl"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/reminder" />
<EditText
android:id="#+id/reminderTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lines="2"
android:background="#drawable/edit_text_design" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="200dp"
>
<Button
android:id="#+id/pickDateBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="showDatePickerDialog"
android:text="#string/datePickerBtnTxt" />
<Button
android:id="#+id/pickTimeBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="showTimePickerDialog"
android:text="#string/pickTimeBtn" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<EditText
android:id="#+id/selectedDate"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<EditText
android:id="#+id/selectedTime"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"/>
</LinearLayout>
</LinearLayout>
<Button
android:id="#+id/submitBtn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_below="#+id/linear_wrapper"
android:onClick="submitData"
android:text="#string/submitBtn" />
</RelativeLayout>
you can place 2 buttons next to each other!
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="10dp"
android:weightSum="1">
<Button
android:id="#+id/btn1"
android:layout_width="wrap_content"
android:gravity="left"
android:layout_height="wrap_content"
android:lines="2" />
<Button
android:id="#+id/btn2"
android:layout_width="fill_parent"
android:gravity="right"
android:layout_height="wrap_content" />
</LinearLayout>
I am trying to move elements, like changeTextView and daysLowTextView from the outermost RelativeLayout to the nested LinearLayout elements labeled col1, col2, col3, and col4, but my app will fail when it opens. I have removed all LinearLayout positioning as well. Any suggestions?
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/mainRelativeLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:stretchColumns="yes"
android:background="#color/black"
tools:context=".MainActivity" >
<LinearLayout android:id="#+id/center"
android:layout_width="1dp"
android:layout_height="1dp"
android:layout_centerHorizontal="true"
android:visibility="invisible"
android:orientation="vertical"/>
<LinearLayout
android:id="#+id/topRowLinearLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/enterSymbolTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/stock_symbol"
android:textColor="#color/white" />
<EditText
android:id="#+id/stockSymbolEditText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:inputType="text"
android:textColor="#color/white"
android:textCursorDrawable="#null" />
<Button
android:id="#+id/enterStockSymbolButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/enter_stock_symbol"
android:textColor="#color/white" />
</LinearLayout>
<TextView
android:id="#+id/companyNameTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/topRowLinearLayout"
android:padding="#dimen/activity_horizontal_margin"
android:layout_toLeftOf="#id/center"
android:text="Company Name"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/white" />
<WebView
android:id="#+id/yahooWebView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" />
<TextView
android:id="#+id/daysLowTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/stock_days_low"
android:textColor="#color/white" />
<TextView
android:id="#+id/yearLowTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/stock_year_low"
android:textColor="#color/white" />
<TextView
android:id="#+id/daysRangeTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/days_range"
android:textColor="#color/white" />
<TextView
android:id="#+id/yearHighTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/stock_year_high"
android:textColor="#color/white" />
<TextView
android:id="#+id/changeTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/change"
android:textColor="#color/white" />
<TextView
android:id="#+id/daysHighTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/stock_days_high"
android:textColor="#color/white" />
<TextView
android:id="#+id/lastTradePriceOnlyTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#id/companyNameTextView"
android:layout_toRightOf="#id/companyNameTextView"
android:text="#string/last_trade_price_only"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/white" />
<!-- Begin 2 columns of data -->
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_above="#id/yahooWebView">
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<LinearLayout
android:id="#+id/col1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1">
</LinearLayout>
<LinearLayout
android:id="#+id/col2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1">
</LinearLayout>
<LinearLayout
android:id="#+id/col3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1">
</LinearLayout>
<LinearLayout
android:id="#+id/col4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1">
</LinearLayout>
</LinearLayout>
</LinearLayout>
<!-- end columns of data -->
</RelativeLayout>
I had to clean the project for some reason, and then it fixed itself.