Keyboard hides view above Recycler View? - android

I want is the following sort of layout:
<CoordinatorLayout>
<ToolBar></ToolBar>
<RelativeLayout></RelativeLayout>
<RecyclerView></RecyclerView>
<LinearLayout>
<EditText></EditText>
</LinearLayout>
<CoordinatorLayout>
However, my issue is when I click on my EditText, the keyboard pops up and shows the RecyclerView perfectly, but when I try to scroll further up, I can't seem to see my RelativeLayout, nor can I see my ToolBar. However, when I don't have the keyboard up, I can see everything fine. Here are some images showing what's happening:
I understand it is most likely because I don't have a parent ScrollView that nests the entire layout, but I can't seem to have that because of my RecyclerView. Is there either a. a way to implement a sort of custom RecyclerView so I can have a ScrollView parent layout or b. find some way for me to be able to scroll and see my ToolBar and RelativeLayout in addition to my RecyclerView? I've included my attempt with a ScrollView but I still can only see the RecyclerView when I click on the EditText. Any help is appreciated. Thanks!
Code:
AndroidManifest.xml:
<activity android:name=".com.tabs.activity.Comments"
android:label="View Post"
android:theme="#style/AppTheme.NoActionBar"
android:configChanges="keyboardHidden"
android:windowSoftInputMode="adjustPan|stateVisible|stateAlwaysHidden">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".com.tabs.activity.news_feed"/>
</activity>
comments.xml:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:flatui="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:fresco="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" android:fitsSystemWindows="true"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
android:id="#+id/comments_coordinator_layout">
<android.support.design.widget.AppBarLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:theme="#style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="#+id/comments_appbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="#style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/layout_comments">
<RelativeLayout
android:layout_marginTop="?attr/actionBarSize"
android:id="#+id/view_post"
android:layout_width="match_parent"
android:paddingRight="5dp"
android:paddingLeft="5dp"
android:orientation="horizontal"
android:layout_height="175dp"
android:background="#e6e6e6">
<com.facebook.drawee.view.SimpleDraweeView
android:layout_marginTop="15dp"
android:id="#+id/poster_picture"
android:layout_width="75dp"
android:layout_height="75dp"
android:layout_marginLeft="10dp"
fresco:placeholderImage="#mipmap/blank_prof_pic"
fresco:roundedCornerRadius="5dp"
fresco:roundAsCircle="true"
/>
<TextView
android:layout_marginLeft="5dp"
android:layout_marginTop="15dp"
android:layout_toRightOf="#id/poster_picture"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:textStyle="bold"
android:id="#+id/poster_name"/>
<TextView
android:layout_alignParentRight="true"
android:layout_marginTop="15dp"
android:layout_toRightOf="#id/poster_name"
android:layout_marginLeft="5dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:id="#+id/post_date"/>
<TextView
android:layout_marginLeft="5dp"
android:layout_toRightOf="#id/poster_picture"
android:layout_below="#id/poster_name"
android:textSize="20sp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/view_status" />
</RelativeLayout>
<LinearLayout
android:id="#+id/send_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:layout_alignParentBottom="true"
android:orientation="horizontal" >
<com.cengalabs.flatui.views.FlatEditText
android:id="#+id/write_comment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="5"
android:paddingLeft="10dp"
android:gravity="bottom|left"
android:cursorVisible="false"
android:hint="Comment back!"
android:inputType="textMultiLine"
flatui:fl_fieldStyle="fl_box"
android:scrollHorizontally="false" />
<com.cengalabs.flatui.views.FlatButton
android:id="#+id/send_comment"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginLeft="5dp"
android:layout_gravity="center_vertical|center_horizontal"
android:gravity="center"
android:text="send"
flatui:theme="#array/sea"
flatui:fl_textAppearance="fl_light"/>
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/view_post"
android:layout_above="#id/send_message"
android:id="#+id/view_comments">
</android.support.v7.widget.RecyclerView>
</RelativeLayout>
</ScrollView>
</android.support.design.widget.CoordinatorLayout>

According to:
I understand it is most likely because I don't have a parent
ScrollView that nests the entire layout, but I can't seem to have
that because of my RecyclerView. Is there either a. a way to
implement a sort of custom RecyclerView so I can have a ScrollView
parent layout or b. find some way for me to be able to scroll and see
my ToolBar and RelativeLayout in addition to my RecyclerView?
I've included my attempt with a ScrollView but I still can only see
the RecyclerView when I click on the EditText. Any help is
appreciated. Thanks!
So you need to extend range of existing ScrollView view. Just put AppBarLayout and RelativeLayout view into new vertical oriented 'LinearLayout', as ScrollView takes only one view. This new created ViewGroup would be an only child of 'CoordinatorLayout'.
Once you wrap AppBarLayout and RelativeLayout' into new madeLinearLayout, put it into existingScrollView`.
Hope you now understand how to do it. If not, tell me and I would tomorrow in the early morning edit my post and change your actual code with desired one.

put your <RecyclerView> in the one <LinearLayout>
and set your linearlayout as match_parent but in your RecyclerView set height="0dp" and use weight="1" like this :
<CoordinatorLayout>
<ToolBar></ToolBar>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<RecyclerView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"></RecyclerView>
</LinearLayout>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
app:layout_anchorGravity="bottom"></EditText>
<CoordinatorLayout>
and then, when your keyboard opens your recyclerview will not be under keyboard and your can scroll to see items under keybard
good lock

Related

view below and overlays another view in android

i want to make a view that will be below another view and overlays it too
i made the following
<RelativeLayout android:layout_height="wrap_content" android:layout_width="wrap_content">
<include layout="#layout/toolbar" android:id="#+id/tool"
/>
<include layout="#layout/content_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/tool"
android:layout_marginBottom="30dp"
/>
</RelativeLayout>
but it didn't work, any solutions?
First, you'll need to reverse the order of the views, toolbar should hide content_main so it should be added after it.
Second, you can use negative margins for this, you tell content_main to be below toolbar, and then put a negative top margin on it, so it moves a bit higher, and beneath toolbar.
Example:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ff0000" >
<TextView
android:text="first line, will be partially covered. fdjkfsjdf kldsjfkdsljfklds "
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/toolbar"
android:layout_marginTop="-20dp"
android:textSize="36sp"
android:fontFamily="sans-serif-light"
android:background="#00ff00"/>
<TextView
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="#0000ff"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:textSize="36sp"
android:text="TOOLBAR" />
</RelativeLayout>
And result:
Try to use a FrameLayout, instead of RelativeLayout.

Android - Padding/Gap on the left of toolbar's child layout

I'm stuck with an issue and I have browsed the entire internet for a solution but nothing is working for me.
I have added an imageview inside my toolbar but it's slightly towards the right. It doesn't align centrally, it's shifted a bit towards the right. When i align the imageview to the left, there's an unknown padding/gap between the imageview and the left side of the toolbar. Following is my XML code:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.CoordinatorLayout 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:fitsSystemWindows="true"
tools:context=".NavigationDrawerHomeScreen.BaseActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/AppTheme.AppBarOverlay"
app:elevation="0dp">
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/toolbar_home_activity"
android:layout_width="match_parent"
android:layout_height="45dp"
android:contentInsetLeft="0dp"
android:contentInsetStart="0dp"
android:contentInsetStartWithNavigation="0dp"
android:minHeight="?attr/actionBarSize"
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
app:contentInsetStartWithNavigation="0dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="#+id/logo_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="#drawable/fixer_title_thick" />
</RelativeLayout>
<android.support.v7.widget.SearchView
android:id="#+id/search_home"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:showAsAction="ifRoom"
android:visibility="gone">
</android.support.v7.widget.SearchView>
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="#+id/container_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="#drawable/home_bg" />
</FrameLayout>
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_centerInParent="true"-->
<!--android:text="this is base" />-->
</android.support.design.widget.CoordinatorLayout>
</RelativeLayout>
<android.support.design.widget.NavigationView
android:id="#+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#2A2929"
android:backgroundTint="#2A2929"
android:fitsSystemWindows="true"
app:headerLayout="#layout/nav_header_home_customer"
app:itemTextAppearance="#style/NavDrawerTextStyle"
app:itemTextColor="#fff"
app:menu="#menu/activity_home_customer_drawer">
<LinearLayout
android:id="#+id/footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom"
android:clickable="true"
android:orientation="vertical">
<!-- any addition stuff you want in yoour footer layout -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="50dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Set Search Radius"
android:textColor="#color/white" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:clipChildren="false">
<com.crystal.crystalrangeseekbar.widgets.CrystalSeekbar
android:id="#+id/rangeSeekbar1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:bar_color="#color/blue"
app:left_thumb_color="#color/blue_dark" />
<TextView
android:id="#+id/textMin1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/rangeSeekbar1"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="5dp"
android:text="0"
android:textColor="#color/white"
android:textSize="16dp" />
<TextView
android:id="#+id/textMax1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="#id/rangeSeekbar1"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:text="100"
android:textColor="#color/white"
android:textSize="16dp" />
</RelativeLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="#1E88E5">
<TextView
android:id="#+id/logout_footer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginBottom="20dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:drawableLeft="#drawable/ic_logout_white_24dp"
android:drawablePadding="32dp"
android:text="Logout"
android:textColor="#fff"
android:textSize="18sp" />
</RelativeLayout>
</LinearLayout>
</android.support.design.widget.NavigationView>
The app:contentinset/android:contentinset solution works for some people but it doesnt work for me.
here's the image http://imgur.com/a/Vp2g6.
I had this same problem, and I tried a lot of things like setting
app:contentInsetStart ="0dp" ;
app:contentInsetStartWithNavigation = "0dp" ;
It didn't work. I even set them to a negative value, but it didn't work. I tried adding a right margin to my child view but it reduced the visible size of child view instead of occupying that left space. So probably child views are not allowed in this space.
So after spending some time I figured there are 2 ways to workaround this problem, one is preferred other I'd not prefer. First let me tell you the one I do not prefer:
Custom Implementation of the Up button: This problem only arises when in your Java Class for this layout you set this toolbar as your ActionBar and you
setDisplayHomeAsUpEnabled(true);
Without this command this problem doesn't exist. So if you don't use the default back button and implement one your own by putting an imageView and providing onClick implementation, this should work fine.
Make ChildViews as rather Siblings: The other method is using the property of toolbar of it being just another view.
I prefer this method because by using this method you can use the android's default up button. The only thing you need to do is - instead of defining child views inside the toolbar, make the child view and toolbar as siblings in a Linear or Relative Layout. This way you can reduce the left space only to "wrap_content" of the toolbar and utilise the left space in other child views. In my app, I even had an onClick functionality on the toolbar which can now be done by giving that functionality on the parent of both the layouts i.e. set the onClick on the LinearLayout.
Though I still don't know the exact reason why the left space exists or is there a way to disable it, but this is a pretty clean method to work around this.

Layout not showing under listview within ScrollView

I have a layout with 1 layout inside of it which is all inside a ScrollView. I am trying to get the whole screen to scroll with the content inside of the listview then the textviews underneath that listview. I get the whole listview to populate and show correctly but the bottom layout with all the textviews do not show up.
<?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">
<include
android:id="#+id/app_bar"
layout="#layout/app_bar" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:layout_below="#id/app_bar">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp">
<ImageView
android:id="#+id/bannerReceiptLogo"
android:layout_width="170dp"
android:layout_height="75dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:background="#drawable/img_logo_receipt_cub" />
<TextView
android:id="#+id/bannerAddressHeader"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_below="#id/bannerReceiptLogo"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="#string/storeHeader"
android:textAlignment="center"
android:textSize="18sp" />
<ListView
android:id="#+id/fullEReceiptListView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/bannerAddressHeader"
android:layout_marginTop="10dp"
android:scrollbars="none"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_below="#id/fullEReceiptListView"
android:layout_weight="1">
<View
android:id="#+id/totalDivider"
android:layout_width="match_parent"
android:layout_height="3dp"
android:background="#color/colorGrey"
/>
<TextView
android:id="#+id/txtSubTotal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SUBTOTAL"
android:textSize="20sp"
android:layout_below="#+id/totalDivider"/>
<TextView
android:id="#+id/txtSubTotalFinal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="$13.58"
android:layout_alignParentRight="true"
android:textSize="20dp"
android:layout_below="#+id/totalDivider"/>
<TextView
android:id="#+id/txtTaxText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TAX"
android:textSize="20sp"
android:layout_below="#+id/txtSubTotal"/>
<TextView
android:id="#+id/txtTaxTotal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="$0.80"
android:layout_alignParentRight="true"
android:textSize="20dp"
android:layout_below="#+id/txtSubTotalFinal"/>
<TextView
android:id="#+id/txtCompleteTotal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TOTAL"
android:textSize="20sp"
android:layout_below="#+id/txtTaxText"/>
<TextView
android:id="#+id/txtCompleteTotalNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="$14.38"
android:layout_alignParentRight="true"
android:textSize="20dp"
android:layout_below="#+id/txtTaxText"/>
</RelativeLayout>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
Do not put ListView inside ScrollView. ListView is a widget that is already scrollable. See NestedScrollView from Support library.
If you set the ListView height to wrap_content the height will have the height to comport all items. That way, the below content will be pushed away.
However Android don't have a great support for nested scrolls, it's considered a bad practice. This way, your ListView will not have the native scroll feature, and will need some hack to work as expected.
A better workaround is use the NestedScrollView, so you scroll may work (maybe you will need put your ListView inside another parent to control the height)
change ListView's layout_height to wrap_content

Swiperefreshlayout with fragment not scrolling up

I have a layout with some preferences. It works correctly in portrait, but not in landscape. I want this layout to refresh with a swiperefreshlayout, and does work. But as i i say in the title, it doesnt scroll up.
Ive been playing with a normal LinearLayout, with a RelativeLayout, using the swiperefreshlayout as the root view, playing with weights, ... but nothing. It either doesnt scroll up, or doesnt show the preferences correctly (only the 1st title). Dont know what else to try.
I should also say, i want this screen to keep a linearlayout at the bottom, fixed there. So, only the preferences would scroll.
Heres what i have right now:
<?xml version="1.0" encoding="utf-8"?>
<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" >
<LinearLayout
android:id="#+id/edittexts"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:elevation="8dp"
android:background="#color/primary"
android:visibility="gone"
android:layout_alignParentBottom="true">
<Button
android:id="#+id/setwallpaperbutton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:onClick="onActivarClick"
android:text="#string/setwallpaperbuton"
android:visibility="gone"
android:clickable="true"
android:enabled="true"/>
<EditText
android:id="#+id/edittextlocation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_margin="2dp"
android:textColor="#android:color/white"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:gravity="center"
android:layout_gravity="center"
android:inputType="textMultiLine"
android:maxLines="2"
android:background="#android:color/transparent"
android:textAppearance="?android:attr/textAppearanceSmall" />
<EditText
android:id="#+id/edittextupdate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_margin="2dp"
android:textColor="#android:color/white"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:gravity="center"
android:layout_gravity="center"
android:inputType="text"
android:background="#android:color/transparent"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
<android.support.v4.widget.SwipeRefreshLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/swipelayout"
android:isScrollContainer="true"
android:layout_alignParentTop="true"
android:layout_above="#+id/edittexts">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true">
<fragment
android:name="es.jnsoft.nowweather.PreferencesFragment"
android:id="#+id/preferencesfragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:layout="#xml/settings"/>
</ScrollView>
</android.support.v4.widget.SwipeRefreshLayout>
</RelativeLayout>
Thanks in advance.
According to the documentation,
[SwipeRefreshLayout] should be made the parent of the view that will be
refreshed as a result of the gesture and can only support one direct
child.
This clause is violated in your layout.

How do I shift the <include> layout to the bottom of the view

I am trying to push my included view to the bottom of the layout, however I am not having any luck.Currently it's placed at the top of the layout.The code for the same is as follows:
<?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:background="#color/altercolor2"
android:clickable="true"
android:orientation="vertical" >
<include
layout="#layout/layout_grid_details_header_view"
android:visibility="gone" />
<include layout="#layout/last_updated_time" />
<RelativeLayout
android:id="#+id/markets_column_names"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/black"
android:paddingBottom="3dp" >
<TextView
android:id="#+id/markets_column_name1"
android:layout_width="75dp"
android:layout_height="wrap_content"
android:layout_toLeftOf="#+id/markets_column_name2"
android:textSize="12sp"
android:gravity="right" />
<TextView
android:id="#+id/markets_column_name2"
android:layout_width="75dp"
android:layout_height="wrap_content"
android:layout_toLeftOf="#+id/markets_column_name3"
android:textSize="12sp"
android:gravity="right" />
<TextView
android:id="#+id/markets_column_name3"
android:layout_width="85dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:textSize="12sp"
android:paddingRight="6dp"
android:gravity="right" />
</RelativeLayout>
<com.handmark.pulltorefresh.library.PullToRefreshListView
android:id="#+id/markets_grid_list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<include layout="#layout/loading_no_results" />
</LinearLayout>
The main thing I am looking to switch at the bottom of the list is : <include layout="#layout/last_updated_time" />
so, I tried I also tried setting paddingbottom andlayout_below: relavitive layout id, and tried setting layout_gravity = bottom and gravity = botttom, still no luck.Any clue how to push this at the bottom of the view such that it still remains visible even if the list is long, but at the bottom of the view, like overlapping the list view at the bottom.
Thanks!Justin
Give layout_width and layout_height attribute to 'include tag', then you can give it any of it's parent tag attribute
Since the root layout is a LinearLayout with a vertical orientation, it is going to be drawn in the order you have them. Simply putting it as the last View in the xml would draw it below the previous View then you could play with margin, padding, whatever to get it to be where you want.
A better option would be to change the root layout to a RelativeLayout and give the View in question the property
android:layout_alignParentBottom="true
You may have to adjust some properties of other Views to get exactly what you want but its hard to say without seeing an image of how it should look. Also, android:layout_below="" wouldn't work with its parent layout being a LinearLayout...that is only a property for RelativeLayout.
Edit with code example
<?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="#color/altercolor2"
android:clickable="true" >
<include
layout="#layout/layout_grid_details_header_view"
android:visibility="gone" />
<include layout="#layout/last_updated_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" />
<RelativeLayout
android:id="#+id/markets_column_names"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/black"
android:paddingBottom="3dp" >
<TextView
android:id="#+id/markets_column_name1"
android:layout_width="75dp"
android:layout_height="wrap_content"
android:layout_toLeftOf="#+id/markets_column_name2"
android:textSize="12sp"
android:gravity="right" />
<TextView
android:id="#+id/markets_column_name2"
android:layout_width="75dp"
android:layout_height="wrap_content"
android:layout_toLeftOf="#+id/markets_column_name3"
android:textSize="12sp"
android:gravity="right" />
<TextView
android:id="#+id/markets_column_name3"
android:layout_width="85dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:textSize="12sp"
android:paddingRight="6dp"
android:gravity="right" />
</RelativeLayout>
<com.handmark.pulltorefresh.library.PullToRefreshListView
android:id="#+id/markets_grid_list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<include layout="#layout/loading_no_results" />
</RelativeLayout >
Try using frame layout : make your current linearlayout as first child (removing the include view that u want to move to bottom). Make the include view as second view and set its layout_gravity to bottom.

Categories

Resources