enable webview zoom control inside scrollview - android

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.

Related

Why does my button not showing in the layout?

I've been making a tabbed activity with a list view in it. I've been trying to put a button under the list view, but when i run on my phone, the button doesn't show up.
My Fragment layout
<FrameLayout 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"
tools:context="com.siscaproject.sisca.Fragment.RegisterFragment">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="7dp">
<RelativeLayout
android:id="#+id/rl_total_data"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorRedPrimary"
android:padding="8dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="#string/item_detected"
android:textColor="#fff" />
<TextView
android:id="#+id/tv_total_data"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginEnd="7dp"
android:hint="10 items detected"
android:textColor="#fff" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/rl_data"
android:layout_below="#id/rl_total_data"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="#+id/lv_data"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true" />
</RelativeLayout>
<Button
android:id="#+id/btn_register"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:background="#color/colorRedPrimary"
android:text="#string/register_all_item"
android:textAllCaps="false"
android:textColor="#fff" />
</RelativeLayout>
</FrameLayout>
My layout preview in my android studio
The layout when i run it on my phone (I'm using an Asus Zenfone 5)
I'm not sure where i did wrong, i actually have change the button into the floating button, but only half of the button shows in the layout. (Plus i can't scroll the layout)
Update
I have resolved it, the problem is in the tabbed activity layout.
I use a constraint layout as the parent, i've changed it to Relative layout and it works perfectly
Try this
change color according to you!
<FrameLayout 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"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="7dp">
<RelativeLayout
android:id="#+id/rl_total_data"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorAccent"
android:padding="8dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="detected"
android:textColor="#fff" />
<TextView
android:id="#+id/tv_total_data"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginEnd="7dp"
android:hint="10 items detected"
android:textColor="#fff"
android:layout_marginRight="7dp" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/rl_data"
android:layout_below="#id/rl_total_data"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="#+id/lv_data"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true" />
</RelativeLayout>
<Button
android:id="#+id/btn_register"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:background="#color/colorPrimary"
android:text="helo"
android:textAllCaps="false"
android:textColor="#fff"
android:layout_alignParentLeft="true" />
</RelativeLayout>
</FrameLayout>
Try this code..
<FrameLayout 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"
tools:context="com.siscaproject.sisca.Fragment.RegisterFragment">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="7dp">
<RelativeLayout
android:id="#+id/rl_total_data"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorRedPrimary"
android:padding="8dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="#string/item_detected"
android:textColor="#fff" />
<TextView
android:id="#+id/tv_total_data"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginEnd="7dp"
android:hint="10 items detected"
android:textColor="#fff" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/rl_data"
android:layout_below="#id/rl_total_data"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="#+id/lv_data"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_above="#+id/btn_register" />
<Button
android:id="#+id/btn_register"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:background="#color/colorAccent"
android:text="submit"
android:textAllCaps="false"
android:textColor="#fff" />
</RelativeLayout>
</RelativeLayout>
Try with this code
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="7dp">
<RelativeLayout
android:id="#+id/rl_total_data"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorPrimary"
android:padding="8dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="Items Detected"
android:textColor="#fff" />
<TextView
android:id="#+id/tv_total_data"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginEnd="7dp"
android:hint="10 items detected"
android:textColor="#fff" />
</RelativeLayout>
<ListView
android:id="#+id/lv_data"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/btn_register"
android:layout_below="#+id/rl_total_data"/>
<Button
android:id="#+id/btn_register"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#color/colorAccent"
android:text="Register"
android:textAllCaps="false"
android:textColor="#fff" />
Try this
<FrameLayout 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"
tools:context="com.siscaproject.sisca.Fragment.RegisterFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="7dp"
android:orientation="vertical">
<RelativeLayout
android:id="#+id/rl_total_data"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorRedPrimary"
android:padding="8dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="#string/item_detected"
android:textColor="#fff" />
<TextView
android:id="#+id/tv_total_data"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginEnd="7dp"
android:hint="10 items detected"
android:textColor="#fff" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/rl_data"
android:layout_below="#id/rl_total_data"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<ListView
android:id="#+id/lv_data"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true" />
</RelativeLayout>
<Button
android:id="#+id/btn_register"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:background="#color/colorRedPrimary"
android:text="#string/register_all_item"
android:textAllCaps="false"
android:textColor="#fff" />
</LinearLayout>
This is because of the "match parent" attribute that is in a view above your button.Your button therefore is not shown because a view on top of it has been set to occupy all the space of the parent.
SEE BELOW CODE modification
<FrameLayout
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"
tools:context="com.siscaproject.sisca.Fragment.RegisterFragment">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="7dp">
<RelativeLayout
android:id="#+id/rl_total_data"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorRedPrimary"
android:padding="8dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="#string/item_detected"
android:textColor="#fff" />
<TextView
android:id="#+id/tv_total_data"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginEnd="7dp"
android:hint="10 items detected"
android:textColor="#fff" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/rl_data"
android:layout_below="#id/rl_total_data"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ListView
android:id="#+id/lv_data"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true" />
</RelativeLayout>
<Button
android:id="#+id/btn_register"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:background="#color/colorRedPrimary"
android:text="#string/register_all_item"
android:textAllCaps="false"
android:textColor="#fff" />
</RelativeLayout>
</FrameLayout>
You could try to use weightSum as explained in this post.What is android:weightSum in android, and how does it work?
It give much more control in division of your parent layout

pull to refresh in scroll view android

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>

to avoid spaces at bottom while scrolling down in scrollview

when i am scrolling down then unnecessary spaces are coming.so pls help me and i am using a scrollView for this activity.This is my .xml file,pls see to it and suggest me what to do because when i am scrolling down that unnecessary space making my app disgusting.
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
android:fillViewport="true">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="5dp"
android:paddingRight="5dp"
tools:context="com.example.vishal.a4sa.rubber">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Rubber Bowl"
android:gravity="center"
android:textColor="#01118c"
android:padding="#dimen/activity_horizontal_margin"
android:textStyle="bold"
android:textSize="30dp"
android:id="#+id/tv"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<ImageView
android:layout_width="match_parent"
android:layout_height="300dp"
android:id="#+id/image"
android:background="#drawable/image1"
android:layout_below="#+id/textView5"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<android.support.v4.widget.Space
android:layout_width="match_parent"
android:layout_height="8dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="900dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000"
android:id="#+id/content"
android:layout_alignParentBottom="true"
android:layout_alignLeft="#+id/imageView"
android:layout_alignStart="#+id/imageView" />
</LinearLayout>
</ScrollView>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="match_parent"
android:paddingLeft="5dp"
android:paddingRight="5dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Rubber Bowl"
android:gravity="center"
android:textColor="#01118c"
android:padding="#dimen/activity_horizontal_margin"
android:textStyle="bold"
android:textSize="30dp"
android:id="#+id/tv"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
<ImageView
android:layout_width="match_parent"
android:layout_height="300dp"
android:id="#+id/image"
android:background="#drawable/image1"
android:layout_below="#+id/textView5"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<android.support.v4.widget.Space
android:layout_width="match_parent"
android:layout_height="8dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000"
android:id="#+id/content"
android:layout_alignParentBottom="true"
android:layout_alignLeft="#+id/imageView"
android:layout_alignStart="#+id/imageView" />
</LinearLayout>
</ScrollView>

SoftKeyboard pushes up the layout in android

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

Showing Loading Bar lib

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>

Categories

Resources