RecyclerView is not taking wrap_content height, it becomes scrollable - android

Details:
Dependency: (latest)
implementation 'com.android.support:recyclerview-v7:27.0.2'
XML:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/bg_gray">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="#dimen/marginTwenty"
android:layout_marginStart="#dimen/marginTwenty"
android:layout_marginTop="#dimen/marginTen"
android:orientation="vertical">
<LinearLayout
android:id="#+id/contactLoadingLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:padding="#dimen/marginThirty">
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/waitText"
android:textAlignment="center"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="#+id/contactsLayoutView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="#+id/mobileView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/curved_background_white"
android:orientation="vertical"
android:padding="#dimen/marginTen">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="#dimen/marginTwenty"
android:layout_height="#dimen/marginTwenty"
android:layout_gravity="center_vertical"
android:layout_marginEnd="5dp"
android:contentDescription="#string/dummyContent"
android:src="#drawable/ic_mobile" />
<TextView
android:id="#+id/txtMobileNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="#string/mobileNumber"
android:textColor="#color/colorPrimary"
android:textSize="#dimen/textSize_18sp"
android:textStyle="bold" />
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="#+id/mobileRecyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:adjustViewBounds="true"
android:scaleType="fitXY" />
<TextView
android:id="#+id/txtNoMobileData"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="#dimen/marginTen"
android:text="#string/no_contact_found"
android:textSize="#dimen/textSize_18sp"
android:textStyle="bold"
android:visibility="gone" />
<TextView
android:id="#+id/btnAddMobile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:text="#string/add"
android:textColor="#color/colorPrimary"
android:textSize="#dimen/textSize_18sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="#+id/emailView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/marginTen"
android:background="#drawable/curved_background_white"
android:orientation="vertical"
android:padding="#dimen/marginTen">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="#dimen/marginTwenty"
android:layout_height="18dp"
android:layout_gravity="center_vertical"
android:layout_marginEnd="5dp"
android:contentDescription="#string/dummyContent"
android:src="#drawable/ic_email" />
<TextView
android:id="#+id/txtEmailNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="#string/email"
android:textColor="#color/colorPrimary"
android:textSize="#dimen/textSize_18sp"
android:textStyle="bold" />
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="#+id/emailRecyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:adjustViewBounds="true"
android:scaleType="fitXY" />
<TextView
android:id="#+id/txtNoEmailData"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="#dimen/marginTen"
android:text="#string/no_contact_found"
android:textSize="#dimen/textSize_18sp"
android:textStyle="bold"
android:visibility="gone" />
<TextView
android:id="#+id/btnAddEmail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:text="#string/add"
android:textColor="#color/colorPrimary"
android:textSize="#dimen/textSize_18sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="#+id/facebookView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/marginTen"
android:background="#drawable/curved_background_white"
android:orientation="vertical"
android:padding="#dimen/marginTen">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="#dimen/marginTwenty"
android:layout_height="#dimen/marginTwenty"
android:layout_gravity="center_vertical"
android:layout_marginEnd="5dp"
android:contentDescription="#string/dummyContent"
android:src="#drawable/ic_facebook" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="#string/facebookHint"
android:textColor="#color/colorPrimary"
android:textSize="#dimen/textSize_18sp"
android:textStyle="bold" />
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="#+id/facebookRecyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:adjustViewBounds="true"
android:scaleType="fitXY" />
<TextView
android:id="#+id/txtNoFacebookData"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="#dimen/marginTen"
android:text="#string/no_contact_found"
android:textSize="#dimen/textSize_18sp"
android:textStyle="bold"
android:visibility="gone" />
<TextView
android:id="#+id/btnAddFacebook"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:text="#string/add"
android:textColor="#color/colorPrimary"
android:textSize="#dimen/textSize_18sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="#+id/linkedInView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/marginTen"
android:background="#drawable/curved_background_white"
android:orientation="vertical"
android:padding="#dimen/marginTen">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="#dimen/marginTwenty"
android:layout_height="#dimen/marginTwenty"
android:layout_gravity="center_vertical"
android:layout_marginEnd="5dp"
android:contentDescription="#string/dummyContent"
android:src="#drawable/ic_linkedi" />
<TextView
android:id="#+id/txtLinkedIn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="#string/linkedInHint"
android:textColor="#color/colorPrimary"
android:textSize="#dimen/textSize_18sp"
android:textStyle="bold" />
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="#+id/linkedInRecyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:adjustViewBounds="true"
android:scaleType="fitXY" />
<TextView
android:id="#+id/txtNoLinkedInData"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="#dimen/marginTen"
android:text="#string/no_contact_found"
android:textSize="#dimen/textSize_18sp"
android:textStyle="bold"
android:visibility="gone" />
<TextView
android:id="#+id/btnAddLinkedIn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:text="#string/add"
android:textColor="#color/colorPrimary"
android:textSize="#dimen/textSize_18sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="#+id/twitterView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/marginTen"
android:background="#drawable/curved_background_white"
android:orientation="vertical"
android:padding="#dimen/marginTen">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="#dimen/marginTwenty"
android:layout_height="#dimen/marginTwenty"
android:layout_gravity="center_vertical"
android:layout_marginEnd="5dp"
android:contentDescription="#string/dummyContent"
android:src="#drawable/ic_twitter" />
<TextView
android:id="#+id/txtTwitter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="#string/twitterHint"
android:textColor="#color/colorPrimary"
android:textSize="#dimen/textSize_18sp"
android:textStyle="bold" />
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="#+id/twitterRecyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:adjustViewBounds="true"
android:scaleType="fitXY" />
<TextView
android:id="#+id/txtNoTwitterData"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="#dimen/marginTen"
android:text="#string/no_contact_found"
android:textSize="#dimen/textSize_18sp"
android:textStyle="bold"
android:visibility="gone" />
<TextView
android:id="#+id/btnAddTwitter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:text="#string/add"
android:textColor="#color/colorPrimary"
android:textSize="#dimen/textSize_18sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="#+id/youtubeView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/marginTen"
android:background="#drawable/curved_background_white"
android:orientation="vertical"
android:padding="#dimen/marginTen">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="#dimen/marginTwenty"
android:layout_height="#dimen/marginTwenty"
android:layout_gravity="center_vertical"
android:layout_marginEnd="5dp"
android:contentDescription="#string/dummyContent"
android:src="#drawable/ic_youtube" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/youtubeHint"
android:textColor="#color/colorPrimary"
android:textSize="#dimen/textSize_18sp"
android:textStyle="bold" />
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="#+id/youtubeRecyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:adjustViewBounds="true"
android:scaleType="fitXY" />
<TextView
android:id="#+id/txtNoYoutubeData"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="#dimen/marginTen"
android:text="#string/no_contact_found"
android:textSize="#dimen/textSize_18sp"
android:textStyle="bold"
android:visibility="gone" />
<TextView
android:id="#+id/btnAddYoutube"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:text="#string/add"
android:textColor="#color/colorPrimary"
android:textSize="#dimen/textSize_18sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:id="#+id/gitHubView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/marginTwenty"
android:layout_marginTop="#dimen/marginTen"
android:background="#drawable/curved_background_white"
android:orientation="vertical"
android:padding="#dimen/marginTen">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="#dimen/marginTwenty"
android:layout_height="#dimen/marginTwenty"
android:layout_gravity="center_vertical"
android:layout_marginEnd="5dp"
android:contentDescription="#string/dummyContent"
android:src="#drawable/ic_github" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:text="#string/gitHubHint"
android:textColor="#color/colorPrimary"
android:textSize="#dimen/textSize_18sp"
android:textStyle="bold" />
</LinearLayout>
<android.support.v7.widget.RecyclerView
android:id="#+id/githubRecyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp" />
<TextView
android:id="#+id/txtNoGitHubData"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="#dimen/marginTen"
android:text="#string/no_contact_found"
android:textSize="#dimen/textSize_18sp"
android:textStyle="bold"
android:visibility="gone" />
<TextView
android:id="#+id/btnAddGithub"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:text="#string/add"
android:textColor="#color/colorPrimary"
android:textSize="#dimen/textSize_18sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<include
android:id="#+id/noInternetLayoutContact"
layout="#layout/no_internet_layout"
android:visibility="gone" />
</LinearLayout>
</ScrollView>
JAVA Code:
youtubeRecyclerView.setLayoutManager(new
LinearLayoutManager(getActContext(), LinearLayoutManager.VERTICAL, false));
youtubeRecyclerView.setHasFixedSize(true);
youtubeRecyclerView.setItemAnimator(new DefaultItemAnimator());
youtubeRecyclerView.setAdapter(attributeAdapter);
youtubeRecyclerView.setVisibility(View.VISIBLE);
Note:
i have 6 recycler views in single activity and out of those 6 any one of the recycler view becomes scrollable and rest works fine (wrap_content) based on screen size.
My Parent View is ScrollView.
I have done enough research on internet and stackoverflow, couldn't find the solution, So asked question here. Please don't mark as duplicate.

Try wrapping RecyclerView using fixed height parent
You can go for a fixed height or wrap_content for LinearLayout parent
<LinearLayout
android:id="#+id/llRecyclerContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/marginTen">
<android.support.v7.widget.RecyclerView
android:id="#+id/facebookRecyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
In your java file :
facebookRecyclerView.setHasFixedSize(true);

It's not good practice to use RecycylerView inside scrollView as result it won't support recycling if views.
Better use one vertical parent RecyclerView and based on view type add your child RecyclerView to parent.

I managed to resolve this issue by putting my recyclerview in a nestedscrollview and kept 'android:nestedScrollingEnabled' disabled/false.

Related

Fragment layout is not scrolling above keyboard when soft keyboard pop ups

I have one fragment whose layout i want to show above keyboard when softkeyboard opens up. The layout is:
<?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:animateLayoutChanges="true"
android:background="#drawable/ic_bg_splash"
android:fitsSystemWindows="true">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="#+id/cardview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2">
<ImageButton
android:id="#+id/previous"
android:layout_width="37.5dp"
android:layout_height="37.5dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="22dp"
android:background="#drawable/left"
android:padding="7dp" />
</RelativeLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:paddingTop="12dp">
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardCornerRadius="7dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="12dp"
android:layout_marginTop="7dp"
android:layout_marginRight="12dp"
android:layout_marginBottom="7dp"
android:orientation="vertical">
<ImageView
android:id="#+id/subCat"
android:layout_width="157.5dp"
android:layout_height="157.5dp" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="50dp"
android:gravity="center"
android:orientation="vertical"
android:paddingTop="12dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="#font/nunito"
android:paddingLeft="20dp"
android:text="#string/enter_answer"
android:textAllCaps="true"
android:textColor="#android:color/white"
android:textSize="13sp" />
<LinearLayout
android:layout_width="262.5dp"
android:layout_height="52.5dp"
android:layout_marginTop="7dp"
android:background="#drawable/answer_bg"
android:orientation="horizontal">
<EditText
android:id="#+id/answer"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_weight="8"
android:background="#null"
android:fontFamily="#font/nunito"
android:inputType="textNoSuggestions"
android:maxLines="1"
android:padding="7dp"
android:textColor="#android:color/white"
android:textSize="15sp" />
<ImageView
android:id="#+id/wrong_answer"
android:layout_width="27.5dp"
android:layout_height="28dp"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="10dp"
android:src="#drawable/red_cross"
android:visibility="gone" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="22dp"
android:layout_marginBottom="27dp"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:id="#+id/reset"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/nunito"
android:text="#string/reset"
android:textAllCaps="true"
android:textColor="#android:color/white"
android:textSize="14.3sp" />
<TextView
android:id="#+id/submit_ans"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="32dp"
android:background="#drawable/white_rounded"
android:fontFamily="#font/nunito_semibold"
android:paddingLeft="17dp"
android:paddingTop="7dp"
android:paddingRight="17dp"
android:paddingBottom="7dp"
android:text="#string/submit"
android:textAllCaps="true"
android:textColor="#color/lineColor"
android:textSize="14.3sp" />
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2">
<ImageButton
android:id="#+id/next"
android:layout_width="37.5dp"
android:layout_height="37.5dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="22dp"
android:background="#drawable/right" />
</RelativeLayout>
</LinearLayout>
<RelativeLayout
android:id="#+id/write_dark"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#70000000"
android:elevation="10dp"
android:visibility="gone">
<ImageView
android:id="#+id/write_success"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="10dp" />
</RelativeLayout>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
I have tried by setting windowssoftinputmode to adjustResize in manifest and also using fitsystemwindows to true in the fragment parent layout but still it is not working and using scrollview as parent layout instead of relativelayout. So please suggest me any workaround for this issue.
Edit: Added below activity.xml layout:
Below is the host activity layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:background="#drawable/language_bg"
android:orientation="vertical"
tools:context=".home.HomeActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/bottom_rounded">
<RelativeLayout
android:id="#+id/taskBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="10dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_gravity="center_vertical"
android:layout_weight="1.7"
android:paddingLeft="30dp"
android:paddingTop="5dp">
<ImageView
android:layout_width="143dp"
android:layout_height="56dp"
android:layout_gravity="left|center_vertical"
android:src="#drawable/hello_logo" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_gravity="center"
android:layout_weight="3"
android:gravity="center"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/learn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical"
android:visibility="gone">
<ImageView
android:layout_width="33dp"
android:layout_height="30dp"
android:layout_gravity="center_vertical"
android:src="#drawable/learn_icon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="5dp"
android:text="#string/learn"
android:textColor="#color/lineColor"
android:textSize="11sp" />
<View
android:id="#+id/learn_bar"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginTop="10dp"
android:background="#color/lineColor" />
</LinearLayout>
<LinearLayout
android:id="#+id/practice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:gravity="center_horizontal"
android:orientation="vertical"
android:visibility="gone">
<ImageView
android:layout_width="42dp"
android:layout_height="28dp"
android:src="#drawable/practice_icon" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="5dp"
android:text="#string/practice"
android:textColor="#color/lineColor"
android:textSize="11sp" />
<View
android:id="#+id/practice_bar"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginTop="10dp"
android:background="#color/lineColor"
android:visibility="gone" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_gravity="center"
android:layout_marginRight="30dp"
android:layout_weight="1.3"
android:gravity="right"
android:orientation="horizontal">
<LinearLayout
android:id="#+id/unlock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical">
<ImageView
android:layout_width="26.5dp"
android:layout_height="32dp"
android:src="#drawable/unlock_blue" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="5dp"
android:text="#string/unlock"
android:textColor="#color/lineColor"
android:textSize="11dp" />
</LinearLayout>
<LinearLayout
android:id="#+id/language"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:gravity="center_horizontal|bottom"
android:orientation="vertical">
<ImageView
android:layout_width="33dp"
android:layout_height="30dp"
android:layout_marginTop="2dp"
android:src="#drawable/language" />
<TextView
android:id="#+id/language_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="5dp"
android:text="#string/lang"
android:textAllCaps="true"
android:textColor="#color/lineColor"
android:textSize="11dp" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/appbar_practice"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorPrimaryDark"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:paddingTop="12dp"
android:visibility="gone">
<LinearLayout
android:id="#+id/read_mode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="23.5dp"
android:layout_height="17.5dp"
android:background="#drawable/icon_read" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="7dp"
android:fontFamily="#font/nunito_semibold"
android:text="#string/read"
android:textAllCaps="true"
android:textColor="#android:color/white"
android:textSize="13sp" />
</LinearLayout>
<View
android:id="#+id/read_bar"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginTop="12dp"
android:background="#android:color/white" />
</LinearLayout>
<LinearLayout
android:id="#+id/speak_mode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="32dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="16.5dp"
android:layout_height="21.5dp"
android:background="#drawable/icon_speak" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="7dp"
android:fontFamily="#font/nunito_semibold"
android:text="#string/speak"
android:textAllCaps="true"
android:textColor="#android:color/white"
android:textSize="13sp" />
</LinearLayout>
<View
android:id="#+id/speak_bar"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginTop="12dp"
android:background="#android:color/white"
android:visibility="gone" />
</LinearLayout>
<LinearLayout
android:id="#+id/listen_mode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="32dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="18.5dp"
android:layout_height="18.5dp"
android:background="#drawable/icon_listen" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="7dp"
android:fontFamily="#font/nunito_semibold"
android:text="#string/listen"
android:textAllCaps="true"
android:textColor="#android:color/white"
android:textSize="13sp" />
</LinearLayout>
<View
android:id="#+id/listen_bar"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginTop="12dp"
android:background="#android:color/white"
android:visibility="gone" />
</LinearLayout>
<LinearLayout
android:id="#+id/write_mode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="32dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:layout_width="17dp"
android:layout_height="19dp"
android:background="#drawable/icon_write" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="7dp"
android:fontFamily="#font/nunito_semibold"
android:text="#string/write"
android:textAllCaps="true"
android:textColor="#android:color/white"
android:textSize="13sp" />
</LinearLayout>
<View
android:id="#+id/write_bar"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_marginTop="12dp"
android:background="#android:color/white"
android:visibility="gone" />
</LinearLayout>
</LinearLayout>
<FrameLayout
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
Try to put your scrollView into relative Layout.
After commenting this from my activity onCreate() it started working:
this.getWindow().setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN
)

textview overlap on recycleview items

I am using a recycleview to show the content and if the content have more than 7 rows the textviews underneath of the recycleview is getting overlapped.
Please let me know how to fix this.Here is my code below.
This doesnt show the problem with lesser recycleview items say 3 or 4 but if I have more itesm like 7 to 8 then the issue is getting reproduced.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/WelcomePageLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#color/main_bg_gray">
<android.support.v7.widget.RecyclerView
android:id="#+id/contentDetailsSummary_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/timeTakenToTransfer"
android:layout_alignParentTop="true"
android:background="#color/white"
android:scrollbars="vertical" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignBottom="#id/contentDetailsSummary_list">
<TextView
android:id="#+id/assisted_acnt_tv" --> this textview is overlapping on the recycleview items
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/activity_horizontal_margin"
android:text="#string/assisted_acnt_setup"/>
<LinearLayout
android:id="#+id/account_button_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="#+id/line_account_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="#dimen/elevation_padding"
android:layout_margin="#dimen/activity_horizontal_margin"
android:textColor="#color/button_text_color"
android:background="#drawable/action_button"
android:gravity="center"
android:layout_weight="1"
android:text="#string/line_backup_ins"
android:textSize="#dimen/button_textsize" />
<Button
android:id="#+id/google_account_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="#dimen/elevation_padding"
android:layout_margin="#dimen/activity_horizontal_margin"
android:textColor="#color/button_text_color"
android:background="#drawable/action_button"
android:gravity="center"
android:layout_weight="1"
android:text="#string/google_acnt_ids_btn"
android:textAllCaps="false"
android:textSize="#dimen/button_textsize" />
</LinearLayout>
</LinearLayout>
<com.abc.xyz.CustomTextView
android:id="#+id/timeTakenToTransfer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:padding="12dp"
style="#style/textStyle_body"
android:layout_above="#+id/uniqueTransactionId"
android:text=""
android:textColor="#color/black" />
<com.abc.xyz.CustomTextView
android:id="#+id/uniqueTransactionId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
android:visibility="gone"
android:layout_marginBottom="20sp"
android:layout_above="#+id/button_layout"
android:layout_centerHorizontal="true"
android:gravity="center_horizontal"
android:text=""
style="#style/textStyle_body"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:id="#+id/button_layout">
<com.abc.xyz.CustomTextView
android:id="#+id/app_install_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginBottom="10dp"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:padding="12dp"
style="#style/textStyle_button"
android:text="#string/install_apps"
android:visibility="gone" />
<com.abc.xyz.CustomTextView
android:id="#+id/summary_finish_button"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="#dimen/button_padding"
android:layout_centerVertical="true"
style="#style/textStyle_button"
android:text="#string/ept_finish_button" />
</RelativeLayout>
</RelativeLayout>
Any help is always appreciated.
Change to this:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/WelcomePageLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#color/main_bg_gray">
<android.support.v7.widget.RecyclerView
android:id="#+id/contentDetailsSummary_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/linear_layout"
android:layout_alignParentTop="true"
android:background="#color/white"
android:scrollbars="vertical" />
<LinearLayout
android:id="#+id/linear_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_above="#+id/timeTakenToTransfer">
<TextView
android:id="#+id/assisted_acnt_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/activity_horizontal_margin"
android:text="#string/assisted_acnt_setup"/>
<LinearLayout
android:id="#+id/account_button_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="#+id/line_account_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="#dimen/elevation_padding"
android:layout_margin="#dimen/activity_horizontal_margin"
android:textColor="#color/button_text_color"
android:background="#drawable/action_button"
android:gravity="center"
android:layout_weight="1"
android:text="#string/line_backup_ins"
android:textSize="#dimen/button_textsize" />
<Button
android:id="#+id/google_account_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="#dimen/elevation_padding"
android:layout_margin="#dimen/activity_horizontal_margin"
android:textColor="#color/button_text_color"
android:background="#drawable/action_button"
android:gravity="center"
android:layout_weight="1"
android:text="#string/google_acnt_ids_btn"
android:textAllCaps="false"
android:textSize="#dimen/button_textsize" />
</LinearLayout>
</LinearLayout>
<com.abc.xyz.CustomTextView
android:id="#+id/timeTakenToTransfer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:padding="12dp"
style="#style/textStyle_body"
android:layout_above="#+id/uniqueTransactionId"
android:text=""
android:textColor="#color/black" />
<com.abc.xyz.CustomTextView
android:id="#+id/uniqueTransactionId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="12dp"
android:visibility="gone"
android:layout_marginBottom="20sp"
android:layout_above="#+id/button_layout"
android:layout_centerHorizontal="true"
android:gravity="center_horizontal"
android:text=""
style="#style/textStyle_body"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:id="#+id/button_layout">
<com.abc.xyz.CustomTextView
android:id="#+id/app_install_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginBottom="10dp"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:padding="12dp"
style="#style/textStyle_button"
android:text="#string/install_apps"
android:visibility="gone" />
<com.abc.xyz.CustomTextView
android:id="#+id/summary_finish_button"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="#dimen/button_padding"
android:layout_centerVertical="true"
style="#style/textStyle_button"
android:text="#string/ept_finish_button" />
</RelativeLayout>
</RelativeLayout>

Scrollview not scrolling

I'm using a scroll view which is having only one child linearlayout.
Linearlayout contains listview and some other items also, but only listview is scrolling. what should i do ?
Here is my layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fresco="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/beco_white"
android:orientation="vertical">
<include layout="#layout/toolbar" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ViewSwitcher
android:id="#+id/view_switcher"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="125dp"
android:background="#android:color/white"
android:orientation="horizontal">
<Button
android:id="#+id/button_sign_in"
android:layout_width="150dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:layout_marginLeft="#dimen/dp20"
android:background="#drawable/dark_blue_round_corner"
android:fontFamily="sans-serif-normal"
android:text="Login to beCo"
android:textAllCaps="false"
android:textColor="#android:color/white"
android:textSize="14sp" />
<Button
android:id="#+id/button_sign_up"
android:layout_width="150dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:layout_marginLeft="20dp"
android:layout_marginRight="#dimen/dp20"
android:background="#drawable/customborder"
android:fontFamily="sans-serif-normal"
android:text="Create New Account"
android:textAllCaps="false"
android:textColor="#color/colorAccent"
android:textSize="14sp" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="125dp"
android:background="#android:color/white">
<com.facebook.drawee.view.SimpleDraweeView
android:id="#+id/image_profile"
android:layout_width="#dimen/dp88"
android:layout_height="#dimen/dp88"
android:layout_gravity="left"
android:layout_marginBottom="#dimen/dp10"
android:layout_marginLeft="#dimen/dp10"
android:layout_marginTop="#dimen/dp10"
fresco:actualImageScaleType="centerCrop"
fresco:placeholderImage="#drawable/no_profile_pic"
fresco:roundAsCircle="true"
fresco:roundingBorderColor="#color/white"
fresco:roundingBorderWidth="#dimen/dp2" />
<TextView
android:id="#+id/user_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="#dimen/dp10"
android:layout_toRightOf="#+id/image_profile"
android:fontFamily="sans-serif-normal"
android:text="John Doe"
android:textColor="#android:color/black"
android:textSize="25sp" />
<TextView
android:id="#+id/email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/user_name"
android:layout_marginLeft="#dimen/dp10"
android:layout_toEndOf="#+id/image_profile"
android:layout_toRightOf="#+id/image_profile"
android:fontFamily="sans-serif-normal"
android:text="johndoe#mail.com"
android:textColor="#android:color/black"
android:textSize="14sp" />
<Button
android:id="#+id/button_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/image_profile"
android:background="#drawable/customborder"
android:text="Edit Profile"
android:textAllCaps="false"
android:textColor="#color/colorAccent" />
</RelativeLayout>
</ViewSwitcher>
<View
android:layout_width="wrap_content"
android:layout_height="1dp"
android:background="#color/grey_200" />
<ListView
android:id="#+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</ScrollView>
</LinearLayout>
Any one please help me?
Never put A ListView inside a ScrollView. It is a bad practice and it defeats the purpose of having a ListView. Who wants two scrollable areas on a screen anyway?
Instead add a header or footer view on your listView depending on what you need.
If you look at the documentation https://developer.android.com/reference/android/widget/ScrollView.html it states that scrollview should never be used with listview there may be a conflict between them.
Try this layout:
changes:
Make your inner linearlayout wrap into Scrollview
Apply android:layout_height="wrap_content" for scrollview
End the scrollview before Listview as both can not be applied together
<?xml version="1.0" encoding="utf-8"?>
<include layout="#layout/toolbar" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ViewSwitcher
android:id="#+id/view_switcher"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="125dp"
android:background="#android:color/white"
android:orientation="horizontal">
<Button
android:id="#+id/button_sign_in"
android:layout_width="150dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:layout_marginLeft="#dimen/dp20"
android:background="#drawable/dark_blue_round_corner"
android:fontFamily="sans-serif-normal"
android:text="Login to beCo"
android:textAllCaps="false"
android:textColor="#android:color/white"
android:textSize="14sp" />
<Button
android:id="#+id/button_sign_up"
android:layout_width="150dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:layout_marginLeft="20dp"
android:layout_marginRight="#dimen/dp20"
android:background="#drawable/customborder"
android:fontFamily="sans-serif-normal"
android:text="Create New Account"
android:textAllCaps="false"
android:textColor="#color/colorAccent"
android:textSize="14sp" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="125dp"
android:background="#android:color/white">
<com.facebook.drawee.view.SimpleDraweeView
android:id="#+id/image_profile"
android:layout_width="#dimen/dp88"
android:layout_height="#dimen/dp88"
android:layout_gravity="left"
android:layout_marginBottom="#dimen/dp10"
android:layout_marginLeft="#dimen/dp10"
android:layout_marginTop="#dimen/dp10"
fresco:actualImageScaleType="centerCrop"
fresco:placeholderImage="#drawable/no_profile_pic"
fresco:roundAsCircle="true"
fresco:roundingBorderColor="#color/white"
fresco:roundingBorderWidth="#dimen/dp2" />
<TextView
android:id="#+id/user_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="#dimen/dp10"
android:layout_toRightOf="#+id/image_profile"
android:fontFamily="sans-serif-normal"
android:text="John Doe"
android:textColor="#android:color/black"
android:textSize="25sp" />
<TextView
android:id="#+id/email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/user_name"
android:layout_marginLeft="#dimen/dp10"
android:layout_toEndOf="#+id/image_profile"
android:layout_toRightOf="#+id/image_profile"
android:fontFamily="sans-serif-normal"
android:text="johndoe#mail.com"
android:textColor="#android:color/black"
android:textSize="14sp" />
<Button
android:id="#+id/button_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/image_profile"
android:background="#drawable/customborder"
android:text="Edit Profile"
android:textAllCaps="false"
android:textColor="#color/colorAccent" />
</RelativeLayout>
</ViewSwitcher>
</LinearLayout>
</ScrollView>
<View
android:layout_width="wrap_content"
android:layout_height="1dp"
android:background="#color/grey_200" />
<ListView
android:id="#+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent" />
Use NestedScrollView instead of ScrollView.
NestedScrollView is just like ScrollView, but it supports acting
as both a nested scrolling parent and child on both new and old
versions of Android.
See the Documentation
Update your XML as below:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fresco="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/beco_white"
android:orientation="vertical">
<include layout="#layout/toolbar" />
<android.support.v4.widget.NestedScrollView
android:id="#+id/layout_scorll"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:descendantFocusability="blocksDescendants">
<ViewSwitcher
android:id="#+id/view_switcher"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="125dp"
android:background="#android:color/white"
android:orientation="horizontal">
<Button
android:id="#+id/button_sign_in"
android:layout_width="150dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:layout_marginLeft="#dimen/dp20"
android:background="#drawable/dark_blue_round_corner"
android:fontFamily="sans-serif-normal"
android:text="Login to beCo"
android:textAllCaps="false"
android:textColor="#android:color/white"
android:textSize="14sp" />
<Button
android:id="#+id/button_sign_up"
android:layout_width="150dp"
android:layout_height="40dp"
android:layout_gravity="center"
android:layout_marginLeft="20dp"
android:layout_marginRight="#dimen/dp20"
android:background="#drawable/customborder"
android:fontFamily="sans-serif-normal"
android:text="Create New Account"
android:textAllCaps="false"
android:textColor="#color/colorAccent"
android:textSize="14sp" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="125dp"
android:background="#android:color/white">
<com.facebook.drawee.view.SimpleDraweeView
android:id="#+id/image_profile"
android:layout_width="#dimen/dp88"
android:layout_height="#dimen/dp88"
android:layout_gravity="left"
android:layout_marginBottom="#dimen/dp10"
android:layout_marginLeft="#dimen/dp10"
android:layout_marginTop="#dimen/dp10"
fresco:actualImageScaleType="centerCrop"
fresco:placeholderImage="#drawable/no_profile_pic"
fresco:roundAsCircle="true"
fresco:roundingBorderColor="#color/white"
fresco:roundingBorderWidth="#dimen/dp2" />
<TextView
android:id="#+id/user_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="#dimen/dp10"
android:layout_toRightOf="#+id/image_profile"
android:fontFamily="sans-serif-normal"
android:text="John Doe"
android:textColor="#android:color/black"
android:textSize="25sp" />
<TextView
android:id="#+id/email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/user_name"
android:layout_marginLeft="#dimen/dp10"
android:layout_toEndOf="#+id/image_profile"
android:layout_toRightOf="#+id/image_profile"
android:fontFamily="sans-serif-normal"
android:text="johndoe#mail.com"
android:textColor="#android:color/black"
android:textSize="14sp" />
<Button
android:id="#+id/button_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/image_profile"
android:background="#drawable/customborder"
android:text="Edit Profile"
android:textAllCaps="false"
android:textColor="#color/colorAccent" />
</RelativeLayout>
</ViewSwitcher>
<View
android:layout_width="wrap_content"
android:layout_height="1dp"
android:background="#color/grey_200" />
<ListView
android:id="#+id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</LinearLayout>
I found the solution by using only with the listview. ie., removing scrollview, and by using headerview for the listview
Xml code for listview
<?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/beco_white"
android:orientation="vertical">
<include layout="#layout/toolbar" />
<View
android:layout_width="wrap_content"
android:layout_height="1dp"
android:background="#color/grey_200" />
<ListView
android:id="#+id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="#drawable/list_divider"
android:dividerHeight="#dimen/dp1"
android:headerDividersEnabled="false"
android:footerDividersEnabled="false" />
</LinearLayout>
xml code for headerview of listview
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fresco="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ViewSwitcher
android:id="#+id/view_switcher"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="150dp"
android:background="#drawable/profile_background"
android:orientation="vertical">
<Button
android:id="#+id/button_sign_in"
android:layout_width="wrap_content"
android:layout_height="36dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="#dimen/dp40"
android:background="#drawable/dark_blue_round_corner"
android:fontFamily="sans-serif-medium"
android:text="Sign in"
android:textAllCaps="true"
android:textColor="#android:color/white"
android:textSize="14sp" />
<LinearLayout
android:id="#+id/button_sign_up"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="#dimen/dp16">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:fontFamily="sans-serif-normal"
android:text="#string/new_to_beco"
android:textColor="#color/beco_white"
android:textSize="14sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="7dp"
android:fontFamily="sans-serif-normal"
android:text="#string/action_sign_up"
android:textAllCaps="true"
android:textColor="#color/beco_primary"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="150dp"
android:background="#drawable/profile_background">
<com.facebook.drawee.view.SimpleDraweeView
android:id="#+id/image_profile"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_gravity="left"
android:layout_marginLeft="15dp"
android:layout_marginStart="15dp"
fresco:actualImageScaleType="centerCrop"
fresco:placeholderImage="#drawable/no_profile_pic"
fresco:roundAsCircle="true"
fresco:roundingBorderColor="#color/white"
fresco:roundingBorderWidth="#dimen/dp2" />
<TextView
android:id="#+id/user_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/image_profile"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="15dp"
android:layout_marginStart="15dp"
android:layout_marginTop="25dp"
android:layout_toEndOf="#+id/image_profile"
android:layout_toRightOf="#+id/image_profile"
android:fontFamily="sans-serif-medium"
android:text="John Doe"
android:textColor="#android:color/black"
android:textSize="18sp" />
<TextView
android:id="#+id/email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/user_name"
android:layout_alignStart="#+id/user_name"
android:layout_below="#+id/user_name"
android:layout_marginTop="8dp"
android:fontFamily="sans-serif-normal"
android:text="johndoe#mail.com"
android:textColor="#android:color/black"
android:textSize="13sp" />
<ImageView
android:id="#+id/action_edit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/email"
android:layout_alignTop="#+id/user_name"
android:layout_marginLeft="11dp"
android:layout_marginStart="11dp"
android:layout_toEndOf="#+id/user_name"
android:layout_toRightOf="#+id/user_name"
android:src="#drawable/ic_edit" />
</RelativeLayout>
</ViewSwitcher>

Background image is not visible if background of above of view is set

I am working on android app where I want to design layout such that "Success" image (20%) - Linearlayout should be top layout and 60%(RelativeLayout) should be in center layout and 20%(LinearLayout) should be on bottom layout.
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/grey_background"
android:orientation="vertical">
<include
android:id="#+id/toolbar"
layout="#layout/toolbar" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#color/grey_background"
android:gravity="center"
android:orientation="horizontal"
android:paddingBottom="10dp"
android:paddingTop="15dp">
<ImageView
android:id="#+id/trans_status_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/sucessfull" />
<in.xxx.utils.RobotoMediumTextView
android:id="#+id/trans_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="Transaction Successfull"
android:textColor="#color/black"
android:textSize="17sp" />
</LinearLayout>
<!--<android.support.v7.widget.CardView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#color/white"
android:elevation="4dp"
>-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:src="#drawable/bill_top" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="-5dp"
android:background="#color/white"
android:orientation="vertical"
android:paddingBottom="20dp"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<in.xxx.utils.RobotoMediumTextView
android:id="#+id/bene_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="#color/black"
android:textSize="20sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:gravity="center"
android:orientation="horizontal"
android:paddingLeft="5dp"
android:paddingRight="5dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="8dp"
android:orientation="vertical"
android:visibility="gone">
<in.xxx.utils.RobotoMediumTextView
android:id="#+id/sender_mobile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="#color/black"
android:textSize="14sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Mobile No."
android:textColor="#color/grey_text_color"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="20dp"
android:orientation="vertical">
<in.xxx.utils.RobotoMediumTextView
android:id="#+id/bene_acc_no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="#color/black"
android:textSize="14sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="A/C No."
android:textColor="#color/grey_text_color"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="20dp"
android:orientation="vertical">
<in.xxx.utils.RobotoMediumTextView
android:id="#+id/trans_mode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="#color/black"
android:textSize="14sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Type"
android:textColor="#color/grey_text_color"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<in.xxx.utils.RobotoMediumTextView
android:id="#+id/bene_ifsc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="#color/black"
android:textSize="14sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="IFSC"
android:textColor="#color/grey_text_color"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#color/dark_grey"
android:padding="10dp">
<android.support.v7.widget.CardView
android:id="#+id/card_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#color/white"
card_view:cardCornerRadius="5dp"
card_view:cardElevation="3dp">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/status_stamp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:src="#drawable/success"
/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="10dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left|center"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Transfer Amount:"
android:textColor="#color/grey_text_color"
android:textSize="11sp" />
<in.xxx.utils.RobotoMediumTextView
android:id="#+id/amount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:textColor="#color/black"
android:textSize="14sp"
android:textStyle="bold" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp"
android:background="#color/grey_background" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Transfer Charges:"
android:textColor="#color/grey_text_color"
android:textSize="11sp" />
<in.xxx.utils.RobotoMediumTextView
android:id="#+id/charges"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|center"
android:layout_marginLeft="10dp"
android:textColor="#color/black"
android:textSize="14sp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center|right"
android:orientation="vertical">
<in.xxx.utils.RobotoMediumTextView
android:id="#+id/amount_total"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:textColor="#color/black"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:text="Total Amount"
android:textColor="#color/grey_text_color"
android:textSize="11sp" />
</LinearLayout>
</FrameLayout>
</FrameLayout>
</android.support.v7.widget.CardView>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#fafafa"
android:orientation="vertical">
<in.xxx.utils.RobotoMediumTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="15dp"
android:text="Transaction details"
android:textColor="#color/black"
android:textSize="16sp" />
<ListView
android:id="#+id/trans_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:cacheColorHint="#00000000"
android:divider="#null"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="8dp"
android:scrollbars="vertical" />
</LinearLayout>
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:src="#drawable/bill_bottom"
android:visibility="visible" />
</LinearLayout>
<!--
</android.support.v7.widget.CardView>
-->
</LinearLayout>
</ScrollView>
</LinearLayout>
</FrameLayout>
If you want to divide the screen on the percentage basis, take LinearLayout as root and then use weight to divide the whole screen in the ratio as needed.
To bring the view on top, after your view is created and attached, add this line:
view.bringToFront();

split relative layout into two equal parts using linear layouts

I have a relative layout which contains two linear layouts. I want these two linear layouts to be placed in either halves of the relative layout containing them i.e. one to be positioned at top half and other at bottom half. Can anyone here help me with this. Here is the xml:
<RelativeLayout
android:id="#+id/updatedetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:orientation="vertical"
android:background="#drawable/oneeventbkg" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="#+id/Top_half_layout">
<ImageView
android:id="#+id/update_sn_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dp"
android:layout_marginTop="2dp" />
<TextView
android:id="#+id/update_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_margin="5dp"
android:textColor="#android:color/white"
android:textSize="14sp" />
<ImageView
android:id="#+id/update_message_pic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#id/update_sn_icon"
android:layout_marginLeft="10dp"
android:layout_marginTop="20dp" />
<TextView
android:id="#+id/update_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#id/update_message_pic"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:maxHeight="400dp"
android:scrollbars="vertical"
android:textColor="#android:color/white"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="#+id/bottom_half_layout">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:id="#+id/toggle_after"
android:visibility="invisible">
<TextView
android:id="#+id/toggle_like_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="10dp"
android:text="1000"
android:background="#android:color/transparent"
android:textColor="#android:color/white"
android:textSize="14sp" />
<ImageButton
android:id="#+id/toggle_like_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#android:color/transparent"
android:src="#drawable/xml_like_button_selctor" />
<TextView
android:id="#+id/toggle_comment_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="7dp"
android:text="100"
android:background="#android:color/transparent"
android:textColor="#android:color/white"
android:textSize="14sp" />
<ImageButton
android:id="#+id/toggle_comment_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#android:color/transparent"
android:src="#drawable/xml_comment_button_selector" />
</LinearLayout>
<ListView
android:id="#+id/likes_list"
android:layout_width="wrap_content"
android:layout_height="200dp"
android:layout_below="#id/toggle_after"
android:padding="20dp"
/>
<ListView
android:id="#+id/comments_list"
android:layout_width="wrap_content"
android:layout_height="200dp"
android:layout_below="#id/toggle_after"
android:padding="20dp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_below="#id/comments_list"
android:layout_marginBottom="10dp"
android:id="#+id/toggle_content"
android:layout_alignParentBottom="true">
<TextView
android:id="#+id/like_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="10dp"
android:text="1000"
android:background="#android:color/transparent"
android:textColor="#android:color/white"
android:textSize="14sp" />
<ImageButton
android:id="#+id/like_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#android:color/transparent"
android:src="#drawable/xml_like_button_selctor" />
<TextView
android:id="#+id/comment_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="7dp"
android:text="100"
android:background="#android:color/transparent"
android:textColor="#android:color/white"
android:textSize="14sp" />
<ImageButton
android:id="#+id/comment_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#android:color/transparent"
android:src="#drawable/xml_comment_button_selector" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
Try this..
<LinearLayout
android:id="#+id/updatedetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:orientation="vertical"
android:background="#drawable/oneeventbkg" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:id="#+id/Top_half_layout">
// Your Codes
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:id="#+id/bottom_half_layout">
// Your Codes
</LinearLayout>
</LinearLayout>
EDIT
<LinearLayout
android:id="#+id/updatedetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:orientation="vertical"
android:background="#drawable/oneeventbkg" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:id="#+id/Top_half_layout">
// Your Codes
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:id="#+id/bottom_half_layout">
// Your Codes
</RelativeLayout>
</LinearLayout>
// Try this way,hope this will help you to solve your problem...
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/updatedetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:background="#drawable/oneeventbkg" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:id="#+id/Top_half_layout"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/update_sn_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginLeft="10dp"
android:layout_marginTop="2dp" />
<TextView
android:id="#+id/update_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:textColor="#android:color/white"
android:layout_gravity="right"
android:textSize="14sp" />
</LinearLayout>
<ImageView
android:id="#+id/update_message_pic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="20dp" />
<TextView
android:id="#+id/update_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:maxHeight="400dp"
android:scrollbars="vertical"
android:textColor="#android:color/white"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:id="#+id/bottom_half_layout"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:id="#+id/toggle_after"
android:visibility="invisible">
<TextView
android:id="#+id/toggle_like_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="10dp"
android:text="1000"
android:background="#android:color/transparent"
android:textColor="#android:color/white"
android:textSize="14sp" />
<ImageButton
android:id="#+id/toggle_like_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#android:color/transparent"
android:src="#drawable/xml_like_button_selctor" />
<TextView
android:id="#+id/toggle_comment_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="7dp"
android:text="100"
android:background="#android:color/transparent"
android:textColor="#android:color/white"
android:textSize="14sp" />
<ImageButton
android:id="#+id/toggle_comment_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#android:color/transparent"
android:src="#drawable/xml_comment_button_selector" />
</LinearLayout>
<ListView
android:id="#+id/likes_list"
android:layout_width="wrap_content"
android:layout_height="200dp"
android:padding="20dp" />
<ListView
android:id="#+id/comments_list"
android:layout_width="wrap_content"
android:layout_height="200dp"
android:padding="20dp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:id="#+id/toggle_content">
<TextView
android:id="#+id/like_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="10dp"
android:text="1000"
android:background="#android:color/transparent"
android:textColor="#android:color/white"
android:textSize="14sp" />
<ImageButton
android:id="#+id/like_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#android:color/transparent"
android:src="#drawable/xml_like_button_selctor" />
<TextView
android:id="#+id/comment_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="7dp"
android:text="100"
android:background="#android:color/transparent"
android:textColor="#android:color/white"
android:textSize="14sp" />
<ImageButton
android:id="#+id/comment_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#android:color/transparent"
android:src="#drawable/xml_comment_button_selector" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>

Categories

Resources