I have viewpager at the top to slide and view images . and after a list to see remaining images or whatever i want to display in list and after that i have a RelativeLayout below this list which i will populate with the Code
Now Issue is :-
I am facing a problem with RecycleView . It was working fine until i add a RelativeLayout to parentofbottom and setting RecycleView property to above this RelativeLayout . Now Issue is RecycleView is not scrolling at all . whats wrong with the code. What needs to be change .Or Suggest me anyother way to achieve this design
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/drawer_layout"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<RelativeLayout
android:id="#+id/container"
android:layout_width="match_parent"
android:focusableInTouchMode="true"
android:layout_height="match_parent" >
<RelativeLayout
android:id="#+id/relativeHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#color/headecolor" >
<Button
android:id="#+id/btnOpenDrawer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:background="#drawable/menu_icon" />
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="#drawable/alert_icon" />
<TextView
android:id="#+id/txtTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:textStyle="bold"
android:text="A La Une"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/blackColor" />
</RelativeLayout>
<android.support.v4.widget.NestedScrollView
android:id="#+id/scroler"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/relativeHeader"
android:fillViewport="true"
android:background="#android:color/white" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusableInTouchMode="true"
android:background="#android:color/white" >
<RelativeLayout
android:id="#+id/relativeLayout1"
android:layout_width="wrap_content"
android:descendantFocusability="blocksDescendants"
android:layout_height="wrap_content" >
<RelativeLayout
android:id="#+id/rlPager"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<egdigital.alpes1.view.WrapContentViewPager
android:id="#+id/view_pager"
android:layout_width="match_parent"
android:layout_height="220dp"
android:adjustViewBounds="true"
android:background="#drawable/news_img_transparent"
/>
<ImageView
android:id="#+id/imageView_dot"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/view_pager"
android:layout_alignParentLeft="true"
android:src="#drawable/scroll_dot1" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:id="#+id/rlRecycle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/relativeLayout1"
android:layout_above="#+id/rlMiniPlayer"
>
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:paddingBottom="80dp">
</android.support.v7.widget.RecyclerView>
</RelativeLayout>
<RelativeLayout
android:id="#+id/rlMiniPlayer"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_alignParentBottom="true"
>
</RelativeLayout>
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
</RelativeLayout>
<fragment
android:id="#+id/navigation_drawer"
android:name=".NavigationDrawerFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:layout_marginLeft="25dp"
tools:layout="#layout/fragment_navigation_drawer" />
</android.support.v4.widget.DrawerLayout>
1) Change
android:layout_below="#+id/relativeLayout1"
to android:layout_below="#id/relativeLayout1" and change anywhere else you have layout_below or layout_above
+ is used when creating a new id. When giving an already created id we use it without +
2) You don't really need RelativeLayout with id rlRecycle. You can directly move layout_below and layout_above attributes to RecyclerView because it's already under top level RelativeLayout
I Found The Solution . i know there are lots of extra RelativeLayouts . Know I removed it . and putted rlMiniPlayer below the nested scrollview
Because I am using nestedscrolling=true . in the code . This is creating the problem
Like This :-
</android.support.v4.widget.NestedScrollView>
<RelativeLayout
android:id="#+id/rlMiniPlayer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
>
</RelativeLayout>
Related
I am having this issue with a Listview, I have a PagerSlidingTabs with 4 tabs and a ViewPager, in the fist tab I have a fragment with a Listview.
The problem is that in the fist item of the list is a litle line that is not supposed to be there. I put the background of the Lisview Red so you can see this litle space that when I scroll is gone.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/adList"
android:visibility="visible">
<ListView
android:id="#+id/matchDetailsListView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:clickable="false"
android:divider="#null"
android:dividerHeight="0dp"
android:background="#color/red" />
</RelativeLayout>
Here is the code of the tabs:
<com.astuetz.PagerSlidingTabStrip
android:id="#+id/tabs"
android:layout_width="match_parent"
android:layout_height="55dp"
android:background="#color/transparent"
android:textColor="#color/white"
app:pstsDividerColor="#color/transparent"
app:pstsIndicatorColor="#color/bg_match_detail"
app:pstsIndicatorHeight="10dp"
app:pstsShouldExpand="true"
app:pstsTabBackground="#color/transparent"
app:pstsTabPaddingLeftRight="18dp"
app:pstsTextAllCaps="false"
app:pstsTriangleIndicator="true"
app:pstsUnderlineHeight="0dp" />
And here is what looks like when scroll the list (You can see that the space is gone) but when you are in the top of the list appears again:
Use this-:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/adList"
android:visibility="visible">
<ListView
android:id="#+id/matchDetailsListView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:clickable="false"
android:divider="#null"
android:dividerHeight="0dp"
android:background="#color/transparent" />
</RelativeLayout>
Instead of-:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/adList"
android:visibility="visible">
<ListView
android:id="#+id/matchDetailsListView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:clickable="false"
android:divider="#null"
android:dividerHeight="0dp"
android:background="#color/red" />
</RelativeLayout>
In my layout I made a LinearLayout with multiple ScrollViews in it, it's supposed to hold a FAQs section there, in the Scrollviews I added multiple expandable TextViews.
The problem is when I just have one it works very fine, when I however add a expandable TextView to the second ScrollView, the Activity keeps crashing and design time shows rendering problems here is my layout code commenting out the second expandable TextView would make it work:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignLeft="#+id/linkbot"
android:layout_alignStart="#+id/linkbot"
android:layout_alignRight="#+id/linkbot"
android:layout_alignEnd="#+id/linkbot"
android:layout_above="#+id/linkbot"
android:layout_below="#+id/textView">
<ScrollView
android:id="#+id/faq1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_above="#+id/faq2"
>
<com.ms.square.android.expandabletextview.ExpandableTextView
android:id="#+id/expandable_text_view1"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:animDuration="200"
app:maxCollapsedLines="1"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="#+id/expandable_text"
android:layout_width="wrap_content"
android:layout_height="match_parent"
/>
<ImageButton
android:id="#+id/expand_collapse"
android:layout_width="wrap_content"
android:layout_gravity="bottom|end"
android:background="#android:color/transparent"
android:padding="14dp"
android:layout_height="match_parent" />
</LinearLayout>
</com.ms.square.android.expandabletextview.ExpandableTextView>
</ScrollView>
<ScrollView
android:id="#+id/faq2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
>
<com.ms.square.android.expandabletextview.ExpandableTextView
android:id="#+id/expandable_text_view2"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:animDuration="200"
app:maxCollapsedLines="1"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/expandable_text2"
android:layout_width="wrap_content"
android:layout_height="match_parent"
/>
<ImageButton
android:id="#+id/expand_collapse2"
android:layout_width="wrap_content"
android:layout_gravity="bottom|end"
android:background="#android:color/transparent"
android:padding="14dp"
android:layout_height="wrap_content" />
</LinearLayout>
</com.ms.square.android.expandabletextview.ExpandableTextView>
</ScrollView>
</LinearLayout>
You have in both ScrollView's #+id/expandable_text/#+id/expandable_text2 and #+id/expand_collapse/#+id/expand_collapse2. Just substitute both with #id/expandable_text and #id/expand_collapse respectively and it will work fine.
If you notice on the ExpandableTextView library documentation, it says that TextView and ImageButton ids inside ExpandableTextView must be set to #id/expandable_text and #id/expand_collapse.
My app have an activity with layuot like this
<RelativeLayout
android:id="#+id/layoutMain"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/backgroundchatfixed">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/layoutKhungChat"
android:id="#+id/svChat">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="#+id/layoutChat">
</LinearLayout>
</ScrollView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/background_khungchat"
android:layout_alignParentBottom="true"
android:id="#+id/layoutKhungChat">
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/khungchat_chat"
android:layout_centerVertical="true"
android:id="#+id/etChatbox"/>
</RelativeLayout>
</RelativeLayout>
When i touch my Edittext, only layout "layoutKungChat" push up.
Any solution to push up also Scrollview above it?
Thanks.
Try adding this to the activity tag in the manifest:
android:windowSoftInputMode="adjustPan"
use this code
<RelativeLayout
android:id="#+id/layoutMain"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/backgroundchatfixed">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/background_khungchat"
android:layout_alignParentBottom="true"
android:id="#+id/layoutKhungChat">
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/khungchat_chat"
android:layout_centerVertical="true"
android:id="#+id/etChatbox"/>
</RelativeLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/layoutKhungChat"
android:id="#+id/svChat">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="#+id/layoutChat">
</LinearLayout>
</ScrollView>
the one in the last always be written over the other layouts so if you want like buttons to be above an image layout as an example write it inside of layout below the image
I am using FrameLayouts to overlap image over image, but I can't understand in this particular scenario where my inner FrameLayout doesn't show at the front of another image. Here's the theory:
and here's the actual thing:
So here's my XML:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/mypage_container"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<FrameLayout
android:id="#+id/frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="#+id/cover_photo"
android:layout_width="match_parent"
android:layout_height="180dp"
android:layout_marginTop="120dp"
android:scaleType="fitXY"
android:src="#CCFF0000" />
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/cover_photo" >
<ImageView
android:layout_width="105dp"
android:layout_height="90dp"
android:layout_below="#id/cover_photo"
android:adjustViewBounds="true"
android:src="#color/aqua"
android:translationY="-45dp" />
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_marginLeft="15dp"
android:src="#color/green"
android:translationY="-40dp" />
</FrameLayout>
</RelativeLayout>
</FrameLayout>
Have I placed the inner FrameLayout wrong? I don't know how what to do anymore.
Any help will be deeply appreciated. Thanks!
It is because your FrameLayout has this line: android:layout_below="#id/cover_photo". You can have FrameLayout like this:
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="-40dp"
android:layout_alignBottom="#id/cover_photo" >
Like the following layout shows, when the items in list are too much, more than one screen.
I can not see the following LinearLayout content when I drag down.
How to solve this problem?
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ListView
android:id="#+id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ListView>
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:layout_below="#+id/list"
android:layout_centerHorizontal="true"
android:orientation="horizontal" >
<TextView
android:id="#+id/UserIDStatic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/UserID" />
.
.
.
</LinearLayout>
</RelativeLayout>
Thanks in advance!
change to this
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ListView
android:id="#+id/list"
android:layout_width="match_parent"
android:layout_height="100dp" > <!-- use a definate dimension here -->
</ListView>
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:layout_below="#+id/list"
android:layout_centerHorizontal="true"
android:orientation="horizontal" >
<TextView
android:id="#+id/UserIDStatic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/UserID" />
.
.
.
</LinearLayout>
</RelativeLayout>
or else put both ListView and LinearLayout in ScrollView
or as bellow comment
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="1"
android:orientatio="verticle" >
<ListView
android:id="#+id/list"
android:layout_weight="0.5"
android:layout_width="match_parent"
android:layout_height="0dp" >
</ListView>
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="0.5"
android:orientation="horizontal" >
<TextView
android:id="#+id/UserIDStatic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/UserID" />
.
.
.
</LinearLayout>
</LinearLayout>
There are two options comes in picture.
Instead of Relative layout Use Vertical Linear layout with appropriate wieght to listview and inner linear layout (eg. 0.7 and 0.3)
Use same Relative layout as above with inner LinearLayout to alignparentbottom = true
and listview above="#innerLinearLayout" linearlayout.
This might solve your problem.
Using specific height for listview might cause different look in UI for different sized screens.