i am trying to show one gridview while selecting some photo from gallery and showing list with recyclerview in a fragment. my layout working well if i do not use swipe refresh layout. can you solve this why this layout not working while using swipe refreshlayout.
xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="com.systechdigital.webadeal.NewsfeedFragment"
android:orientation="vertical"
android:background="#969696"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#023956"
>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="50dp"
android:src="#drawable/globe"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:id="#+id/notificationButtonId"
android:background="?android:attr/selectableItemBackground"
android:paddingRight="10dp"
/>
</RelativeLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:paddingBottom="10dp"
android:descendantFocusability="beforeDescendants"
android:focusableInTouchMode="true"
>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Share you thoughts here..."
android:paddingLeft="10dp"
android:background="#drawable/edittext_status_background"
android:padding="20dp"
android:elevation="5dp"
android:id="#+id/editTextWritePostId"
/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:fitsSystemWindows="true"
android:background="#f9f9f9"
>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Post"
android:textColor="#ffffff"
android:background="#1470a6"
android:id="#+id/postButtonId"
/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/checkInButtonId"
android:layout_toLeftOf="#+id/smileyButtonId"
android:layout_centerInParent="true"
android:src="#drawable/ic_checkin"
android:background="#android:color/transparent"
android:layout_marginRight="3dp"
/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/smiley"
android:layout_toLeftOf="#+id/imageUploadButtonId"
android:layout_centerInParent="true"
android:layout_marginRight="10dp"
android:id="#+id/smileyButtonId"
/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/camera"
android:layout_toLeftOf="#+id/videoUploadButtonId"
android:layout_centerInParent="true"
android:layout_alignParentEnd="true"
android:layout_marginRight="10dp"
android:id="#+id/imageUploadButtonId"
/>
</RelativeLayout>
<GridView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/gridViewId"
android:layout_below="#+id/postButtonId"
android:numColumns="auto_fit"
android:columnWidth="100dp"
android:verticalSpacing="10dp"
android:horizontalSpacing="10dp"
android:layout_marginTop="5dp"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/underline"
android:minHeight="0dp"
/>
**<android.support.v4.widget.SwipeRefreshLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/swipeRefreshLayoutId"
>**
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/recyclerviewId_newsFeed"
android:nestedScrollingEnabled="true"
/>
**</android.support.v4.widget.SwipeRefreshLayout>**
</LinearLayout>
</ScrollView>
</LinearLayout>
1. Don't use GridView, ListView or RecyclerView inside ScrollView. Use NestedScrollView instead of your 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.
2. Use SwipeRefreshLayout as parent of NestedScrollView.
3. Use attribute android:descendantFocusability="blocksDescendants" to LinearLayout instead of android:descendantFocusability="beforeDescendants".
4. Use attribute android:nestedScrollingEnabled="false" to RecyclerView.
Update your layout as below:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#969696">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#023956">
<ImageButton
android:layout_width="wrap_content"
android:layout_height="50dp"
android:src="#drawable/ic_group"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:id="#+id/notificationButtonId"
android:background="?android:attr/selectableItemBackground"
android:paddingRight="10dp" />
</RelativeLayout>
<android.support.v4.widget.SwipeRefreshLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/swipeRefreshLayoutId">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:paddingBottom="10dp"
android:descendantFocusability="blocksDescendants">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Share you thoughts here..."
android:paddingLeft="10dp"
android:padding="20dp"
android:elevation="5dp"
android:id="#+id/editTextWritePostId" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:fitsSystemWindows="true"
android:background="#f9f9f9">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Post"
android:textColor="#ffffff"
android:background="#1470a6"
android:id="#+id/postButtonId" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/checkInButtonId"
android:layout_toLeftOf="#+id/smileyButtonId"
android:layout_centerInParent="true"
android:src="#drawable/ic_action_cart"
android:background="#android:color/transparent"
android:layout_marginRight="3dp" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/ic_play"
android:layout_toLeftOf="#+id/imageUploadButtonId"
android:layout_centerInParent="true"
android:layout_marginRight="10dp"
android:id="#+id/smileyButtonId" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/ic_camera"
android:layout_centerInParent="true"
android:layout_alignParentEnd="true"
android:layout_marginRight="10dp"
android:id="#+id/imageUploadButtonId" />
</RelativeLayout>
<GridView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/gridViewId"
android:layout_below="#+id/postButtonId"
android:numColumns="auto_fit"
android:columnWidth="100dp"
android:verticalSpacing="10dp"
android:horizontalSpacing="10dp"
android:layout_marginTop="5dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="0dp" />
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerviewId_newsFeed"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:nestedScrollingEnabled="false" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.v4.widget.SwipeRefreshLayout>
</LinearLayout>
Hope this will help~
just replace your swipe view at top of your layout like this
<android.support.v4.widget.SwipeRefreshLayout
android:id="#+id/swipeRefreshLayoutId"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<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="#969696"
android:orientation="vertical"
tools:context="com.systechdigital.webadeal.NewsfeedFragment"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#023956">
<ImageButton
android:id="#+id/notificationButtonId"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:background="?android:attr/selectableItemBackground"
android:paddingRight="10dp"
android:src="#drawable/globe" />
</RelativeLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:descendantFocusability="beforeDescendants"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:paddingBottom="10dp">
<EditText
android:id="#+id/editTextWritePostId"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/edittext_status_background"
android:elevation="5dp"
android:hint="Share you thoughts here..."
android:padding="20dp"
android:paddingLeft="10dp"
/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="#f9f9f9"
android:fitsSystemWindows="true">
<Button
android:id="#+id/postButtonId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#1470a6"
android:text="Post"
android:textColor="#ffffff" />
<ImageButton
android:id="#+id/checkInButtonId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginRight="3dp"
android:layout_toLeftOf="#+id/smileyButtonId"
android:background="#android:color/transparent"
android:src="#drawable/ic_checkin" />
<ImageButton
android:id="#+id/smileyButtonId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginRight="10dp"
android:layout_toLeftOf="#+id/imageUploadButtonId"
android:background="#drawable/smiley" />
<ImageButton
android:id="#+id/imageUploadButtonId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerInParent="true"
android:layout_marginRight="10dp"
android:layout_toLeftOf="#+id/videoUploadButtonId"
android:background="#drawable/camera" />
</RelativeLayout>
<GridView
android:id="#+id/gridViewId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/postButtonId"
android:layout_marginTop="5dp"
android:columnWidth="100dp"
android:horizontalSpacing="10dp"
android:numColumns="auto_fit"
android:verticalSpacing="10dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/underline"
android:minHeight="0dp" />
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerviewId_newsFeed"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:nestedScrollingEnabled="true" />
</LinearLayout>
</ScrollView>
</LinearLayout>
</android.support.v4.widget.SwipeRefreshLayout>
Related
So I have this layout with some ChipsInput inside a scrollview and I simply want these to go to the very top when the keyboard is activated
I've tried to change windowSoftInputMode to adjustPan and others but it does not make it to go to the very top, just doesn't cover it.
Here's my xml layout
<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:id="#+id/constraintLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/background1"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical">
<LinearLayout
android:id="#+id/layoutImage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:background="#color/colorPrimary"
android:elevation="12dp"
android:orientation="horizontal"
android:padding="10dp"
tools:targetApi="lollipop">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_margin="3dp"
android:layout_weight="1"
android:fontFamily="#font/quattrocento"
android:gravity="left"
android:text="#string/profile"
android:textSize="20sp"
android:textStyle="bold"
android:textColor="#color/textColor1"
tools:ignore="RtlHardcoded" />
<ImageButton
android:id="#+id/btUpdate"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="3"
android:background="#color/colorPrimary"
android:src="#drawable/arrow_right_icon" />
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="5dp"
android:orientation="vertical"
tools:targetApi="o">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="#font/quattrocento"
android:gravity="center"
android:text="#string/gallery"
android:textSize="22sp"
android:textStyle="bold"
android:textColor="#color/textColor2"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:orientation="horizontal"
android:padding="5dp"
android:baselineAligned="false">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<ImageButton
android:id="#+id/close1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/icon_close"
android:background="#color/white"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:elevation="7dp"
android:visibility="invisible"/>
<ImageButton
android:id="#+id/add1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/icon_add"
android:background="#color/white"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:elevation="7dp"/>
<ImageView
android:id="#+id/photo1"
android:layout_width="match_parent"
android:layout_height="115dp"
android:layout_marginHorizontal="5dp"
android:background="#drawable/rounded_rect_primary_dark"
android:elevation="5dp"
android:scaleType="fitXY"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<ImageButton
android:id="#+id/close2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/icon_close"
android:background="#color/white"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:elevation="7dp"
android:visibility="invisible"/>
<ImageButton
android:id="#+id/add2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/icon_add"
android:background="#color/white"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:elevation="7dp"/>
<ImageView
android:id="#+id/photo2"
android:layout_width="match_parent"
android:layout_height="115dp"
android:layout_marginHorizontal="5dp"
android:background="#drawable/rounded_rect_primary_dark"
android:elevation="5dp"
android:scaleType="fitXY" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<ImageButton
android:id="#+id/close3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/icon_close"
android:background="#color/white"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:elevation="7dp"
android:visibility="invisible"/>
<ImageButton
android:id="#+id/add3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/icon_add"
android:background="#color/white"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:elevation="7dp"/>
<ImageView
android:id="#+id/photo3"
android:layout_width="match_parent"
android:layout_height="115dp"
android:layout_marginHorizontal="5dp"
android:background="#drawable/rounded_rect_primary_dark"
android:elevation="5dp"
android:scaleType="fitXY"/>
</RelativeLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginHorizontal="12dp"
android:layout_marginVertical="5dp"
android:background="#color/black" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/quattrocento"
android:text="#string/about_me"
android:textColor="#color/textColor2"
android:textSize="20sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="#color/white">
<EditText
android:id="#+id/description"
android:layout_width="match_parent"
android:layout_height="70dp"
android:background="#color/white"
android:focusable="true"
android:maxLength="500"
android:inputType="text"
android:importantForAutofill="no"
android:autofillHints="no"
tools:ignore="LabelFor" />
<TextView
android:id="#+id/caracCounter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/quattrocento"
android:text="500"
android:textColor="#color/black"
android:textSize="16sp"
android:layout_gravity="end" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="center"
android:gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/quattrocento"
android:text="#string/interest1"
android:textColor="#color/textColor2"
android:textSize="20sp"
android:layout_gravity="center"
android:gravity="center"/>
<Spinner
android:id="#+id/categories1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:background="#color/colorPrimary" />
</LinearLayout>
<com.pchmn.materialchips.ChipsInput
android:id="#+id/chipsInput1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="#color/white"
android:elevation="3dp"
android:focusable="false"
app:chip_deletable="true"
app:chip_hasAvatarIcon="false"
app:hint="#"
app:chip_backgroundColor="#color/colorPrimary"
app:chip_deleteIconColor="#color/black"
app:chip_labelColor="#color/black"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="center"
android:gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginStart="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/quattrocento"
android:text="#string/interest2"
android:textColor="#color/textColor2"
android:textSize="20sp"
android:layout_gravity="center"
android:gravity="center"/>
<Spinner
android:id="#+id/categories2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:background="#color/colorPrimary" />
</LinearLayout>
<com.pchmn.materialchips.ChipsInput
android:id="#+id/chipsInput2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="#color/white"
android:elevation="3dp"
android:focusable="false"
app:chip_deletable="true"
app:chip_hasAvatarIcon="false"
app:hint="#"
app:chip_backgroundColor="#color/colorPrimary"
app:chip_deleteIconColor="#color/black"
app:chip_labelColor="#color/black" />
<Button
android:id="#+id/btLogout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_margin="25dp"
android:background="#color/colorPrimary"
android:elevation="12dp"
android:fontFamily="#font/quattrocento"
android:text="#string/logout"
android:textSize="20sp"
android:onClick="logout"
tools:targetApi="lollipop"
android:textColor="#color/black"/>
</LinearLayout>
</ScrollView>
I simply need it to be sent to the very top of the layout so my filterable list will appear when the user start to type.
You can use CoordinatorLayout as your root and NestedScrolView in it .
CoordinatorLayout as root reacts to keyboard and scrolls your layout to the top of your phone with assistant of NestedScrollView which your NestedScrollView includes your layout code .
To put the issue into perspective view
CoordinaterLayout > NestedScrolView > yourLayout
Change your layout XMl like code below
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="#+id/constraintLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/background1"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical">
<!-- rest of your layout xml code-->
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
I am making an android app that has a cardview inside a recyclerview. Cardview looks good on tablet and takes 40% size of screen. When i run it on a 5" android device, cardview covers 80% of screen size. Please check the code below and suggest some solutions to correct layout that automatically fits itself according to the screen sizes.
MainLayout.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/main_linearLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="false"
android:layout_alignParentEnd="true"
android:layout_below="#+id/empty_view"
android:orientation="vertical">
<SearchView
android:id="#+id/searchbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerview"
android:layout_width="match_parent"
android:scrollbars="vertical"
android:clipToPadding="false"
android:layout_height="0dp"
android:layout_weight="1"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Load More"
android:id="#+id/btnLoad"
android:layout_gravity="center_horizontal"
android:layout_below="#+id/recyclerview"
android:background="#42a7f4" />
</LinearLayout>
</LinearLayout>
CardViewTemplate.xml
<?xml version="1.0" encoding="utf-8" ?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_height="wrap_content"
android:layout_width="match_parent">
<android.support.v7.widget.CardView
android:id="#+id/card_view"
android:layout_gravity="start"
android:layout_width="match_parent"
card_view:cardUseCompatPadding="true"
android:layout_height="500dp"
android:layout_marginBottom="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="10dp"
card_view:contentPaddingLeft="5dp"
card_view:contentPaddingRight="5dp"
card_view:contentPaddingTop="5dp"
card_view:cardCornerRadius="0dp">
<RelativeLayout
android:layout_height="match_parent"
android:layout_width="match_parent">
<LinearLayout
android:id="#+id/greenBoxView"
android:background="#EBEFF2"
android:layout_height="50dp"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_alignParentTop="true"
>
<ImageView
android:layout_height="30dp"
android:layout_width="30dp"
android:layout_alignParentLeft="true"
android:layout_marginLeft="5dp"
android:src="#drawable/lab"
android:layout_gravity="center_vertical"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Yay! This is a Sample Title Text"
android:textColor="#002868"
android:textStyle="bold"
android:paddingRight="70dp"
android:paddingLeft="60dp"
android:textSize="25dp"
android:layout_gravity="center_vertical" />
<ImageView
android:layout_height="30dp"
android:layout_width="30dp"
android:layout_alignParentRight="true"
android:src="#drawable/lab"
android:layout_marginRight="8dp"
android:layout_gravity="center_vertical"
/>
</LinearLayout>
<LinearLayout
android:layout_below="#id/greenBoxView"
android:layout_above="#+id/footer"
android:id="#+id/centeralPart"
android:paddingTop="5dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#000"
android:textSize="20dp"
android:id="#+id/txtMaintitle" />
<TextView
android:textColor="#0080ff"
android:textSize="20dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/txtSecondTitle" />
<ListView
android:id="#+id/mainlist_view"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:divider="#null"
android:dividerHeight="0dp"/>
</LinearLayout>
<LinearLayout
android:id="#id/footer"
android:layout_height="80dp"
android:layout_width="match_parent"
android:layout_alignParentBottom="true"
android:gravity="center_horizontal"
android:orientation="horizontal">
<Button
android:id="#+id/btnOrder"
android:layout_gravity="center_vertical"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Order"
android:background="#00AF50"
android:textColor="#FFFFFF"
android:layout_marginRight="10dp" />
<Button
android:id="#+id/btnCompare"
android:layout_gravity="center_vertical"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Compare"
android:textColor="#FFFFFF"
android:background="#0071C1" />
</LinearLayout>
</RelativeLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
This is what CardViewTemplate.xml should look like:
<?xml version="1.0" encoding="utf-8" ?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="HardcodedText,ContentDescription" >
<android.support.v7.widget.CardView
android:id="#+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_marginBottom="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="10dp"
card_view:cardCornerRadius="0dp"
card_view:cardUseCompatPadding="true"
card_view:contentPaddingLeft="5dp"
card_view:contentPaddingRight="5dp"
card_view:contentPaddingTop="5dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="#+id/greenBoxView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#EBEFF2"
android:orientation="horizontal">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="5dp"
android:src="#drawable/lab"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingEnd="70dp"
android:paddingStart="60dp"
android:text="Yay! This is a Sample Title Text"
android:textColor="#002868"
android:textSize="25sp"
android:textStyle="bold" />
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center_vertical"
android:layout_marginEnd="8dp"
android:src="#drawable/lab" />
</LinearLayout>
<LinearLayout
android:id="#+id/centeralPart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/footer"
android:layout_below="#id/greenBoxView"
android:gravity="center_horizontal"
android:orientation="vertical"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="5dp">
<TextView
android:id="#+id/txtMaintitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#000"
android:textSize="20sp" />
<TextView
android:id="#+id/txtSecondTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#0080ff"
android:textSize="20sp" />
<ListView
android:id="#+id/mainlist_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="#null"
android:dividerHeight="0dp" />
</LinearLayout>
<LinearLayout
android:id="#id/footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:gravity="center_horizontal"
android:orientation="horizontal">
<Button
android:id="#+id/btnOrder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="10dp"
android:background="#00AF50"
android:text="Order"
android:textColor="#FFFFFF" />
<Button
android:id="#+id/btnCompare"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="#0071C1"
android:text="Compare"
android:textColor="#FFFFFF" />
</LinearLayout>
</RelativeLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
In case this does not fit with your idea, please provide a screenshot of an inflated item view or a drawing of the layout.
I have a webview inside Scrollview .I need to have zoom control when tap on webview but apparently it does not work when parent layout is scrollview . what is the solution? is there any way to have zoom control in this situation?
here is my xml code:
<android.support.v4.widget.DrawerLayout 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:id="#+id/drawer_layout"
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:id="#+id/container_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone">
<include
android:id="#+id/toolbar"
layout="#layout/toolbar" />
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFF">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFF"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="380dp">
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="300dp"
android:background="#color/item_bg"
android:orientation="vertical">
<TextView
android:id="#+id/tv_title_news"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:paddingBottom="20dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="20dp"
android:shadowColor="#000"
android:shadowDx="1"
android:shadowDy="3"
android:shadowRadius="5"
android:text="Medium"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#FFF" />
</LinearLayout>
<ImageView
android:id="#+id/img_news_pic"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:visibility="gone" />
<ir.whc.news.views.CircularNetworkImageView
android:id="#+id/img_circleThumbnail1"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginBottom="33dp"
android:layout_marginLeft="10dp">
</ir.whc.news.views.CircularNetworkImageView>
<TextView
android:id="#+id/tv_cnt_eye"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/linearLayout1"
android:layout_marginBottom="10dp"
android:layout_marginTop="5dp"
android:layout_toRightOf="#+id/fontAwesomeText1"
android:paddingLeft="6dp"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#FFF"
android:textSize="11dp" />
<com.beardedhen.androidbootstrap.AwesomeTextView
android:id="#+id/fontAwesomeText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/linearLayout1"
android:layout_marginBottom="10dp"
android:layout_marginLeft="16dp"
android:layout_toRightOf="#+id/img_circleThumbnail1"
android:textColor="#FFF"
app:fontAwesomeIcon="fa_eye"
/>
<com.beardedhen.androidbootstrap.AwesomeTextView
android:id="#+id/fontAwesomeText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/fontAwesomeText1"
android:layout_marginLeft="16dp"
android:layout_marginTop="10dp"
android:layout_toRightOf="#+id/img_circleThumbnail1"
android:textColor="#000"
app:fontAwesomeIcon="fa_clock_o" />
<TextView
android:id="#+id/tv_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/fontAwesomeText1"
android:layout_marginTop="10dp"
android:layout_toRightOf="#+id/fontAwesomeText2"
android:paddingLeft="6dp"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000"
android:textSize="13dp" />
</RelativeLayout>
<TextView
android:id="#+id/tv_sum_news"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:lineSpacingExtra="15dp"
android:paddingBottom="20dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:id="#+id/tv_desc_news"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:textAppearance="?android:attr/textAppearanceSmall"
android:visibility="gone" />
<WebView
android:scrollbars="vertical"
android:clickable="true"
android:id="#+id/webView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textAlignment="center"
android:textDirection="rtl" />
</LinearLayout>
</ScrollView>
<LinearLayout
android:background="#drawable/grad"
android:layout_alignParentTop="true"
android:layout_width="match_parent"
android:layout_height="50dp"
android:gravity="right">
<ImageView
android:id="#+id/image_bookmark_content"
android:layout_width="#dimen/bookmerk_content_size"
android:layout_height="#dimen/bookmerk_content_size"
android:src="#drawable/ic_bookmark_normal"/>
<ImageView
android:id="#+id/image_share_content"
android:layout_width="#dimen/bookmerk_content_size"
android:layout_height="#dimen/bookmerk_content_size"
android:src="#drawable/ic_share"/>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
<fragment
android:id="#+id/fragment_navigation_drawer"
android:name="ir.whc.news.activity.FragmentDrawer"
android:layout_width="#dimen/nav_drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
app:layout="#layout/fragment_navigation_drawer"
tools:layout="#layout/fragment_navigation_drawer" />
</android.support.v4.widget.DrawerLayout>
Use,
webView.getSettings().setBuiltInZoomControls(true);
webView.getSettings().setDisplayZoomControls(false);
and
Check if you don't have a ScrollView wrapping your Webview.
In my case that was the problem. It seems ScrollView gets in the way of the pinch gesture.
To fix it, just take your Webview outside the ScrollView.
I have an activity in which I am using the fragment. In fragment I have custom toolbar, a list and a EditTextView. When Keyboard visible in this Activity, it pushes up layout. How can I prevent the toolbar to be at its original position.
Following code is written in my fragment:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/layout_alert_main_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/bg_hexa">
<TextView
android:id="#+id/channel_title"
android:paddingLeft="10dp"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:background="#color/black"
android:textColor="#color/white"
android:textSize="16sp"
android:visibility="gone"
android:layout_below="#id/layout_alert_top"
android:layout_alignParentTop="true"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<RelativeLayout
android:id="#+id/layout_alert_top"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="visible"
android:background="#color/app_blue"
android:orientation="horizontal">
<RelativeLayout
android:id="#+id/layout_channel_back_view"
android:layout_width="50dp"
android:layout_height="50dp"
android:clickable="true"
android:focusable="true">
<ImageView
android:id="#+id/title_bar_left_menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#drawable/ic_menu_white_32"/>
</RelativeLayout>
<TextView
android:id="#+id/tv_screen_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:text="#string/channel_title"
android:layout_centerInParent="true"
android:textSize="24sp"
android:textColor="#color/white_text"/>
<RelativeLayout
android:id="#+id/channels_sliding_menu"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentRight="true"
android:clickable="true"
android:focusable="true">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#drawable/ic_tab_channels_white"/>
</RelativeLayout>
</RelativeLayout>
<android.support.v4.widget.DrawerLayout
android:id="#+id/drawer_layout"
android:layout_below="#+id/channel_title"
android:isScrollContainer="false"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:id="#+id/layout_list_alerts"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent">
<TextView
android:id="#+id/zero_conversation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:textColor="#color/dark_gray_text"
android:layout_centerInParent="true"
android:text="Empty"
android:visibility="gone"/>
<RelativeLayout
android:id="#+id/layout_type_message"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:orientation="horizontal"
android:background="#color/gray">
<EditText
android:id="#+id/et_type_message"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_toLeftOf="#+id/layout_send_message"
android:background="#drawable/square_round_corners"
android:hint="Type your message.."
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="10dp"
android:padding="5dp"
android:singleLine="true"
android:textColor="#color/black"
android:textColorHint="#color/black"
android:textSize="16sp"/>
<Button
android:id="#+id/layout_send_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_alignParentRight="true"
android:padding="5dp"
android:textSize="16sp"
android:textStyle="bold"
android:background="#color/transparent"
android:textColor="#color/dark_gray_text"
android:layout_centerInParent="true"
android:text="Send"/>
</RelativeLayout>
<ListView
android:id="#+id/conversation_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#id/layout_type_message"
android:divider="#null"
android:listSelector="#color/transparent"
android:stackFromBottom="true"
android:transcriptMode="normal"
/>
</RelativeLayout>
<FrameLayout
android:id="#+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false" >
</FrameLayout>
<ListView
android:id="#+id/channels_list"
android:background="#color/gray"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="#null"
android:layout_gravity="right"
android:choiceMode="singleChoice" />
</android.support.v4.widget.DrawerLayout>
</RelativeLayout>
Hello, Try to apply this attribute in Activity Tag in Manifest file and let me know if you
can get your desired output or not. Okay.
android:windowSoftInputMode="stateAlwaysHidden|adjustResize"
> XML file` :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/layout_alert_main_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFF">
<RelativeLayout
android:id="#+id/layout_alert_top"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#000000"
android:orientation="horizontal"
android:visibility="visible">
<RelativeLayout
android:id="#+id/layout_channel_back_view"
android:layout_width="50dp"
android:layout_height="50dp"
android:clickable="true"
android:focusable="true">
<ImageView
android:id="#+id/title_bar_left_menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#FFFFFF" />
</RelativeLayout>
<TextView
android:id="#+id/tv_screen_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:paddingBottom="10dp"
android:paddingTop="10dp"
android:text="Title"
android:textColor="#FFFFFF"
android:textSize="24sp" />
<RelativeLayout
android:id="#+id/channels_sliding_menu"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentRight="true"
android:clickable="true"
android:focusable="true">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#drawable/ic_logo" />
</RelativeLayout>
</RelativeLayout>
<android.support.v4.widget.DrawerLayout
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:isScrollContainer="false">
<RelativeLayout
android:id="#+id/layout_list_alerts"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/zero_conversation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="Empty"
android:textColor="#000000"
android:textSize="16sp"
android:visibility="gone" />
<RelativeLayout
android:id="#+id/layout_type_message"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:background="#000000"
android:orientation="horizontal">
<EditText
android:id="#+id/et_type_message"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="5dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:layout_toLeftOf="#+id/layout_send_message"
android:background="#FFFFFF"
android:hint="Type your message.."
android:padding="5dp"
android:singleLine="true"
android:textColor="#000000"
android:textColorHint="#000000"
android:textSize="16sp" />
<Button
android:id="#+id/layout_send_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerInParent="true"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:background="#000000"
android:padding="5dp"
android:text="Send"
android:textColor="#FFFFFF"
android:textSize="16sp"
android:textStyle="bold" />
</RelativeLayout>
<ListView
android:id="#+id/conversation_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#id/layout_type_message"
android:divider="#null"
android:stackFromBottom="true"
android:transcriptMode="normal" />
</RelativeLayout>
<FrameLayout
android:id="#+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false"></FrameLayout>
<ListView
android:id="#+id/channels_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="right"
android:background="#000000"
android:choiceMode="singleChoice"
android:divider="#null"
tools:listtem="#layout/demo_layout" />
</android.support.v4.widget.DrawerLayout>
</RelativeLayout>
Use Scroll view in Ur Layout or Use the code in the manifest.xml.
<activity android:windowSoftInputMode="adjustPan">
Read this :
http://developer.android.com/guide/topics/manifest/activity-element.html#wsoft
and use adjustPan
Hi there I am trying to use this lib into my app
https://github.com/jlmd/AnimatedCircleLoadingView
I want it to on top of that layout, can someone please show me ho it is done?
I trying adding it but it either covered the whole screen or it would occupy a part of layout completly
layout
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/postBg"
android:orientation="vertical"
tools:ignore="ContentDescription">
<include
android:id="#+id/app_bar"
layout="#layout/app_bar"/>
<LinearLayout
android:id="#+id/newStatusHeader"
style="#style/newStatusHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp">
<ImageView
android:id="#+id/postOwnerImage"
android:layout_width="60dp"
android:layout_height="60dp"/>
<LinearLayout
android:id="#+id/headerInfoContainer"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:orientation="vertical"
android:padding="#dimen/postsItemMargin">
<TextView
android:id="#+id/postOwnerName"
style="#style/postOwnerName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<TextView
android:id="#+id/postPrivacy"
style="#style/postPublishDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/publicPrivacy"/>
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#E9E9E9"/>
<LinearLayout
android:id="#+id/newStatusBody"
style="#style/newStatusBody"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#color/white"
android:orientation="vertical">
<ImageView
android:id="#+id/imagePreview"
android:layout_width="match_parent"
android:layout_height="170dp"
android:scaleType="centerCrop"
android:visibility="gone"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.github.jlmd.animatedcircleloadingview.AnimatedCircleLoadingView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/circle_loading_view"
android:layout_width="250dp"
android:layout_height="250dp"
android:layout_centerInParent="true"
app:mainColor="#color/primaryColor"
app:secondaryColor="#color/primaryColorDark"
android:layout_gravity="top" />
</LinearLayout>
<EditText
android:id="#+id/statusEdittext"
style="#style/statusEditText"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:gravity="top|left"
android:hint="#string/urStatus"
android:inputType="textMultiLine"
android:padding="5dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/white"
android:orientation="vertical">
<LinearLayout
android:id="#+id/placePreviewLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:visibility="gone">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:src="#drawable/ic_place_black"/>
<TextView
android:id="#+id/placeValuePreview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="Rue Ibn ElArabi, Agadir 80000, Morocco"
android:textColor="#color/primary_high_light"/>
<TextView
android:id="#+id/removePlace"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:padding="4dp"
android:textStyle="bold"
android:textColor="#android:color/holo_red_light"
android:text="X"/>
</LinearLayout>
<LinearLayout
android:id="#+id/urlPreviewLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:visibility="gone"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:src="#drawable/ic_insert_link_black"/>
<TextView
android:id="#+id/urlValuePreview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="https://www.atouchlab.com"
android:textColor="#color/primary_high_light"/>
<TextView
android:id="#+id/removeLink"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:padding="4dp"
android:textStyle="bold"
android:textColor="#android:color/holo_red_light"
android:text="X"/>
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#E9E9E9"/>
<LinearLayout
android:id="#+id/newStatusFooter"
style="#style/newStatusFooter"
android:layout_width="match_parent"
android:layout_height="65dp">
<LinearLayout
android:layout_width="0dp"
android:layout_height="65dp"
android:layout_weight="1">
<ImageButton
android:id="#+id/addPhoto"
style="#style/actionAreaBtns"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/bg_camera_button"
android:layout_gravity="center" />
<ImageButton
android:id="#+id/addPlace"
style="#style/actionAreaBtns"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/bg_place_button"
android:layout_gravity="center" />
<ImageButton
android:id="#+id/addLink"
style="#style/actionAreaBtns"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/bg_insert_link_button"
android:layout_gravity="center" />
<ImageButton
android:id="#+id/changePrivacy"
style="#style/actionAreaBtns"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/bg_privacy_button"
android:layout_gravity="center" />
</LinearLayout>
<ImageButton
android:id="#+id/sendStatus"
style="#style/actionAreaBtns"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/bg_publish_button"
android:layout_gravity="center" />
</LinearLayout>
</LinearLayout>
lib layout
<com.github.jlmd.animatedcircleloadingview.AnimatedCircleLoadingView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/circle_loading_view"
android:layout_width="250dp"
android:layout_height="250dp"
android:background="#color/background"
android:layout_centerInParent="true"
app:mainColor="#color/main_color"
app:secondaryColor="#color/secondary_color"
/>
Your problem can be solved using an relative layout that wraps the view where you want the LoadingView to be on top of, ex:
<RelativeLayout>
<com.github.jlmd.animatedcircleloadingview.AnimatedCircleLoadingView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/circle_loading_view"
android:layout_width="250dp"
android:layout_height="250dp"
android:layout_centerInParent="true"
app:mainColor="#color/primaryColor"
app:secondaryColor="#color/primaryColorDark"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/circle_loading_view">
//the view on top of witch the loading bar should be
</LinearLayout>
</RelativeLayout>