I cannot widen buttons on my Android project. I'm only having an issue with one of them.
This is what I'm getting
And this is what I want
Only the buttons. Here is my XML for the corresponding issue.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#4ECDC4"
tools:context=".MainActivity" >
<RelativeLayout
android:id="#+id/rlSignInForm"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/rlSignInTitle"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="36dp" >
<LinearLayout
android:id="#+id/llSignInBody"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#FFFFFF"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:visibility="visible"
android:weightSum="2" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="20dp"
android:layout_weight="1" >
<ImageView
android:id="#+id/ivEmailIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/email_icon"
android:contentDescription="#null"
android:layout_alignBottom="#+id/etSignInEmail"
android:layout_marginBottom="2dp"/>
<EditText
android:id="#+id/etSignInEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:background="#null"
android:layout_toRightOf="#+id/ivEmailIcon"
android:layout_marginLeft="10dp"
android:gravity="bottom"
android:hint="#string/email"
android:inputType="textEmailAddress"
android:textColor="#android:color/black"
android:textSize="18sp" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#drawable/sign_in_divider" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="20dp"
android:layout_weight="1" >
<ImageView
android:id="#+id/ivPasswordIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/password_icon"
android:contentDescription="#null"
android:layout_alignBottom="#+id/etSignInPassword"
android:layout_marginBottom="3dp"/>
<EditText
android:id="#+id/etSignInPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:background="#null"
android:layout_toRightOf="#+id/ivPasswordIcon"
android:layout_marginLeft="10dp"
android:gravity="bottom"
android:hint="#string/password"
android:inputType="textPassword"
android:textColor="#android:color/black"
android:textSize="18sp" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/llSignUpBody"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#FFFFFF"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:visibility="visible"
android:weightSum="3" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="20dp"
android:layout_weight="1" >
<ImageView
android:id="#+id/ivUserNameIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/username_icon"
android:contentDescription="#null"
android:layout_alignBottom="#+id/etSignUpName"/>
<EditText
android:id="#+id/etSignUpName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_toRightOf="#+id/ivUserNameIcon"
android:background="#null"
android:gravity="bottom"
android:hint="#string/username"
android:singleLine="true"
android:textColor="#android:color/black"
android:textSize="18sp" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#drawable/sign_in_divider" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="20dp"
android:layout_weight="1" >
<ImageView
android:id="#+id/ivEmailIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/email_icon"
android:contentDescription="#null"
android:layout_alignBottom="#+id/etSignUpEmail"
android:layout_marginBottom="2dp"/>
<EditText
android:id="#+id/etSignUpEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_toRightOf="#+id/ivEmailIcon"
android:background="#null"
android:gravity="bottom"
android:hint="#string/email"
android:inputType="textEmailAddress"
android:textColor="#android:color/black"
android:textSize="18sp" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#drawable/sign_in_divider" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="20dp"
android:layout_weight="1" >
<ImageView
android:id="#+id/ivPasswordIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/password_icon"
android:contentDescription="#null"
android:layout_alignBottom="#+id/etSignUpPassword"
android:layout_marginBottom="3dp"/>
<EditText
android:id="#+id/etSignUpPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_toRightOf="#+id/ivPasswordIcon"
android:background="#null"
android:gravity="bottom"
android:hint="#string/password"
android:inputType="textPassword"
android:textColor="#android:color/black"
android:textSize="18sp" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/llForgotPasswordBody"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#FFFFFF"
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:weightSum="2"
android:visibility="gone" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_margin="20dp"
android:layout_weight="1" >
<ImageView
android:id="#+id/ivEmailIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/email_icon"
android:contentDescription="#null"
android:layout_alignBottom="#+id/etForgotPasswordEmail"
android:layout_marginBottom="2dp"/>
<EditText
android:id="#+id/etForgotPasswordEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:background="#null"
android:layout_toRightOf="#+id/ivEmailIcon"
android:layout_marginLeft="10dp"
android:gravity="bottom"
android:hint="#string/email"
android:inputType="textEmailAddress"
android:textColor="#android:color/black"
android:textSize="18sp" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
<Button
android:id="#+id/btnForgotPassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="#+id/rlSignInForm"
android:layout_below="#+id/rlSignInForm"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:background="#null"
android:text="#string/forgot_password"
android:textColor="#FFFFFF"
android:textSize="14sp" />
<Button
android:id="#+id/btnSendPassword"
android:layout_width="175dp"
android:layout_height="55dp"
android:layout_below="#+id/rlSignInTitle"
android:layout_centerHorizontal="true"
android:layout_marginTop="180dp"
android:background="#drawable/rounded_rect_positive_selector"
android:gravity="center"
android:text="#string/SEND_PASSWORD"
android:textColor="#android:color/white"
android:textStyle="bold"
android:width="175dp"
android:height="55dp"
android:visibility="gone" />
<Button
android:id="#+id/btnActive"
android:layout_width="175dp"
android:layout_height="55dp"
android:layout_alignLeft="#+id/btnInactive"
android:layout_alignRight="#+id/rlSignInForm"
android:layout_below="#+id/rlSignInTitle"
android:layout_marginTop="280dp"
android:background="#AD5BDB"
android:gravity="center"
android:text="#string/SIGN_IN"
android:textColor="#android:color/white"
android:textSize="22sp"
android:textStyle="bold"
android:visibility="visible" />
<Button
android:id="#+id/btnInactive"
style="#style/AppTheme"
android:layout_width="175dp"
android:layout_height="55dp"
android:layout_alignLeft="#+id/rlSignInForm"
android:layout_alignRight="#+id/rlSignInForm"
android:layout_below="#+id/btnActive"
android:layout_marginTop="14dp"
android:background="#AD58DB"
android:gravity="center"
android:text="#string/SIGN_UP"
android:textColor="#android:color/white"
android:textSize="22sp"
android:textStyle="bold"
android:visibility="visible" />
<RelativeLayout
android:id="#+id/rlNoInternetNotification"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/rlSignInTitle"
android:visibility="gone" >
<include layout="#layout/no_internet_notification" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/rlPushNotification"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/rlSignInTitle"
android:visibility="gone" >
<include layout="#layout/push_notification" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/rlSignInTitle"
android:layout_width="match_parent"
android:layout_height="44dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="30dp"
android:background="#4ECDC4" >
<com.cloverstudio.spika.view.MyriadProTextView
android:id="#+id/tvSignInTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="#string/SIGN_IN"
android:textColor="#android:color/white"
android:textSize="26sp" />
</RelativeLayout>
</RelativeLayout>
The smaller button is btnSendPassword and the other button is btnActive. I've tried playing with the widths but nothing changed. I'm fairly new so any explaination why this is happening would be good, so then I know whats wrong if it happens again.Any help would be wonderful.
You should align your btnSendPassword button with rlSignInForm for both left and right...then you will achieve your requirement. Replace the following XML snippet of btnSendPassword with your existing XML snippet of btnSendPassword...you will get all the problem solved.
<Button
android:id="#+id/btnSendPassword"
android:layout_width="175dp"
android:layout_height="55dp"
android:layout_below="#+id/rlSignInTitle"
android:layout_alignLeft="#+id/rlSignInForm"
android:layout_alignRight="#+id/rlSignInForm"
android:layout_marginTop="180dp"
android:background="#drawable/rounded_rect_positive_selector"
android:gravity="center"
android:text="#string/SEND_PASSWORD"
android:textColor="#android:color/white"
android:textStyle="bold"
android:visibility="gone" />
Set android:layout_width="match_parent". This should solve your problem.
Related
I want to scroll recyclerview with dyanmic position for that i have used below layout but when i am set dynamic position in recyclerview. it is scroll but not above appbar layout.
So how to scroll both recyclerview and appbarlayout when set dynamic position using .
Is it possible parralel scroll if i will set dyamic position.
new Handler().postDelayed(new Runnable() {
#Override
public void run() {
rclTrendDetail.smoothScrollToPosition (3);
}
}, 2000);
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:fbutton="http://schemas.android.com/tools"
>
<android.support.design.widget.CoordinatorLayout
android:id="#+id/coordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/relativeTop"
android:background="#color/colorWhite"
android:padding="0dp"
>
<android.support.design.widget.AppBarLayout
android:id="#+id/appbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/colorWhite"
>
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/collapsingLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/colorWhite"
app:contentScrim="#color/colorTransparent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/colorWhite"
android:orientation="vertical"
>
<RelativeLayout
android:id="#+id/relativeProfile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorWhite"
>
<RelativeLayout
android:id="#+id/relativeVideo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/colorWhite"
android:visibility="gone"
>
<com.malmstein.fenster.view.FensterVideoView
android:id="#+id/videoplayer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
/>
<LinearLayout
android:id="#+id/linearPlay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#drawable/round_button_progress_bar"
android:gravity="center"
android:orientation="vertical"
>
<ImageView
android:id="#+id/imgShadow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:layout_marginTop="15dp"
android:src="#drawable/ic_play"
/>
</LinearLayout>
<com.spoof.app.customcontrol.CustomButtonRegular
android:id="#+id/gobbleVdoTxt"
style="#style/MyCustomButton"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="25dp"
android:background="#drawable/round_button_progress_bar"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:textAllCaps="false"
android:textColor="#color/colorWhite"
android:textSize="12sp"
android:textStyle="normal"
android:visibility="gone"
/>
<RelativeLayout
android:id="#+id/relativeVideoTime"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="20dp"
android:visibility="gone"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_toLeftOf="#+id/btnOnSale"
android:background="#drawable/round_button_progress_bar"
>
<com.spoof.app.customcontrol.CustomTextViewRegular
android:id="#+id/txtUpdateTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="15dp"
android:maxLines="1"
android:textAllCaps="false"
android:textColor="#color/colorWhite"
android:textSize="12sp"
android:textStyle="normal"
/>
<app.minimize.com.seek_bar_compat.SeekBarCompat
android:id="#+id/range_slider5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_toLeftOf="#+id/txtTotalTime"
android:layout_toRightOf="#+id/txtUpdateTime"
android:maxHeight="300sp"
app:progressBackgroundColor="#color/colorWhite"
app:progressColor="#color/colorWhite"
app:thumbColor="#color/colorWhite"
/>
<com.spoof.app.customcontrol.CustomTextViewRegular
android:id="#+id/txtTotalTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="15dp"
android:maxLines="1"
android:textAllCaps="false"
android:textColor="#color/colorWhite"
android:textSize="12sp"
android:textStyle="normal"
/>
</RelativeLayout>
<com.spoof.app.customcontrol.CustomButtonRegular
android:id="#+id/btnOnSale"
style="#style/MyCustomButton"
android:layout_width="100dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_marginRight="15dp"
android:background="#drawable/round_button_progress_bar"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:text="#string/on_sale"
android:textAllCaps="false"
android:textColor="#color/colorWhite"
android:textSize="13sp"
android:textStyle="normal"
android:visibility="gone"
/>
<LinearLayout
android:id="#+id/linearGift"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="15dp"
android:background="#drawable/round_button_progress_bar"
android:gravity="center"
android:visibility="gone"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="8dp"
android:src="#drawable/ic_gift"
/>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="#+id/imgSpoofImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:scaleType="fitXY"
/>
<RelativeLayout
android:id="#+id/relativeImgCorner"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</RelativeLayout>
<com.spoof.app.customcontrol.CustomButtonRegular
android:id="#+id/gobbleImgTxt"
style="#style/MyCustomButton"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="25dp"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:alpha="0.5"
android:background="#drawable/round_button_progress_bar"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:textAllCaps="false"
android:textColor="#color/colorWhite"
android:textSize="12sp"
android:textStyle="normal"
android:visibility="gone"
/>
</RelativeLayout>
<com.spoof.app.customcontrol.CustomButtonRegular
android:id="#+id/btnOnSaleImage"
style="#style/MyCustomButton"
android:layout_width="80dp"
android:layout_height="30dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_margin="15dp"
android:background="#drawable/round_button_progress_bar"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:text="#string/on_sale"
android:textAllCaps="false"
android:textColor="#color/colorWhite"
android:textSize="12sp"
android:textStyle="normal"
android:visibility="gone"
/>
<LinearLayout
android:id="#+id/linearGiftImage"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_margin="15dp"
android:background="#drawable/round_button_progress_bar"
android:gravity="center"
android:visibility="gone"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="8dp"
android:src="#drawable/ic_gift"
/>
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<LinearLayout
android:id="#+id/linearTop"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:orientation="vertical"
>
<com.spoof.app.customcontrol.CustomTextViewLight
android:id="#+id/txtComment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="80dp"
android:layout_marginTop="5dp"
android:gravity="left|center_vertical"
android:textAllCaps="false"
android:textColor="#color/colorCrownBlack"
android:textSize="28sp"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="80dp"
android:orientation="horizontal"
>
<ImageView
android:id="#+id/imgCrown"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:scaleType="fitXY"
/>
<com.spoof.app.customcontrol.CustomTextViewLight
android:id="#+id/txtTotalSpoof"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:textAllCaps="false"
android:textColor="#color/colorCrownBlack"
android:textSize="13sp"
/>
</LinearLayout>
<RelativeLayout
android:id="#+id/relativeMain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<RelativeLayout
android:id="#+id/relativeImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<ImageView
android:id="#+id/imgProfileBG"
android:layout_width="55dp"
android:layout_height="73dp"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:scaleType="fitXY"
/>
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/imgProfile"
android:layout_width="55dp"
android:layout_height="55dp"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:layout_marginTop="18dp"
app:civ_border_width="4dp"
/>
</RelativeLayout>
<com.spoof.app.customcontrol.CustomTextViewMedium
android:id="#+id/txtUserName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dp"
android:layout_marginTop="20dp"
android:layout_toRightOf="#+id/relativeImage"
android:maxLines="1"
android:textAllCaps="false"
android:textColor="#color/colorDarkGray"
android:textSize="18sp"
/>
<com.spoof.app.customcontrol.CustomTextViewRegular
android:id="#+id/txtTrendTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/txtUserName"
android:layout_marginLeft="10dp"
android:layout_toRightOf="#+id/relativeImage"
android:maxLines="1"
android:text=""
android:textAllCaps="false"
android:textColor="#color/colorLoginText"
android:textSize="12sp"
/>
<com.spoof.app.customcontrol.CustomButtonRegular
android:id="#+id/btnFollow"
style="#style/MyCustomButton"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="#drawable/round_button_light_gray"
android:text="#string/following"
android:textAllCaps="false"
android:textColor="#color/colorCrownBlack"
android:textSize="10sp"
android:textStyle="normal"
android:visibility="gone"
/>
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginTop="5dp"
android:scaleType="fitXY"
android:src="#drawable/ic_separador"
/>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView
android:id="#+id/rclTrendDetail"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="fill_vertical"
android:scrollbars="vertical"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
>
</android.support.v7.widget.RecyclerView>
</android.support.design.widget.CoordinatorLayout>
<LinearLayout
android:id="#+id/linearShare"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_margin="5dp"
android:gravity="center"
android:layout_alignParentRight="true"
android:layout_below="#+id/relativeTop"
>
<ImageView
android:id="#+id/imgShare"
android:layout_width="30dp"
android:layout_height="32dp"
android:layout_gravity="center"
android:src="#drawable/ico_share"
/>
</LinearLayout>
<RelativeLayout
android:id="#+id/relativeHome"
android:layout_width="61dp"
android:layout_height="61dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="30dp"
android:visibility="visible"
>
<info.hoang8f.widget.FButton
android:id="#+id/imgHome"
fbutton:buttonColor="#color/colorDarkGray"
fbutton:cornerRadius="5dp"
fbutton:shadowColor="#color/colorTransparent"
fbutton:shadowEnabled="false"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_centerInParent="true"
android:visibility="gone"
app:shadowHeight="0dp"
/>
<ImageView
android:id="#+id/imgIconHome"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_centerInParent="true"
/>
<com.spoof.app.customcontrol.CustomTextViewMedium
android:id="#+id/txtTitle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:textColor="#color/colorDarkGray"
android:textSize="16sp"
android:visibility="gone"
/>
</RelativeLayout>
</RelativeLayout>
I don't think that's possible, but if you always want to collapse the appbar, regardless of the position that you choose, you could simply call this after every request for the scroll:
appBarLayout.setExpanded(true/false)
This will cause the app bar to collapse.
Further reading:
AppBarLayout.setExpanded(boolean)
Out of scope:
You should split your XML files into more layouts and use <include> tag, this will greatly improve readability of those files.
Below code has a bottom bar with two buttons which is fixed and not scrollable.
Above bottom bar the layout is scrollable. But the bottom content in the ScrollView hides behind the bottom bar.
I tried changing the parent layout which was not fixing the issue.
I don't know where I am wrong. Any help would be really thankfull.
Code as follows
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include
android:id="#+id/toolbar"
layout="#layout/toolbar" />
<View
android:layout_width="match_parent"
android:layout_height="6dp"
android:layout_marginTop="0dp"
android:background="#drawable/toolbar_dropshadow" />
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#fff"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff"
android:orientation="vertical" >
<TextView
android:id="#+id/text_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="20dp"
android:text="Name"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
<ImageView
android:id="#+id/image_full"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:padding="20dp"
android:scaleType="fitXY" />
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:scrollbars="none">
<LinearLayout
android:id="#+id/imageall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"></LinearLayout>
</HorizontalScrollView>
<TextView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="10dp"
android:background="#bcbcbc"></TextView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:orientation="vertical"
android:weightSum="2">
<TextView
android:id="#+id/price_full_offer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Price"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
<TextView
android:id="#+id/price_full"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text=""
android:textColor="#000"
android:textSize="12sp" />
</LinearLayout>
<fone.adipoli.shopping.Rounded_textview
android:id="#+id/circle_txt"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:layout_marginRight="70dp"
android:gravity="center"
android:padding="3dp"
android:text="" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="#bcbcbc"></TextView>
<TextView
android:id="#+id/stock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:layout_marginTop="10dp"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:layout_marginTop="10dp"
android:text="Check Availability"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
<TextView
android:id="#+id/item_available_cart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:text=""
android:textSize="12dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="3">
<EditText
android:id="#+id/enterpin"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="15dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:layout_weight="2"
android:background="#drawable/edittext_border"
android:cursorVisible="false"
android:hint="Enter Pincode"
android:inputType="number"
android:padding="5dp" />
<Button
android:id="#+id/pincheck"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center|right"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:background="#000"
android:text="Check"
android:textColor="#color/white" />
</LinearLayout>
<RelativeLayout
android:id="#+id/chnge_rl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="#+id/item_available"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:text=""
android:textSize="14dp" />
<TextView
android:id="#+id/change_pin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="50dp"
android:text="Change\nPincode"
android:textColor="#color/blue"
android:textSize="14dp" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:text="Description :\n"
android:textColor="#000"
android:textSize="18dp"
android:textStyle="bold" />
<RelativeLayout
android:id="#+id/des_rl"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="0dp"
android:orientation="vertical">
<WebView
android:id="#+id/text_des"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Full details"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
<RelativeLayout
android:id="#+id/bottom_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/blue"
android:orientation="horizontal"
android:weightSum="2" >
<Button
android:id="#+id/addtocart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/blue"
android:text="Add to Cart"
android:textColor="#color/white"
android:textStyle="bold" />
<TextView
android:layout_width="2dp"
android:layout_height="wrap_content"></TextView>
<Button
android:id="#+id/buynow"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/blue"
android:text="Buy Now "
android:textColor="#color/white"
android:textStyle="bold" />
</LinearLayout>
</RelativeLayout>
Remove whole of the first LinearLayout
Add the below line to your ScrollView
android:layout_above="#+id/bottom_bar"
This makes sure that your ScrollView ends before the bottom bar so theres no overlapping.
In your first LinearLayout add android:layout_above="#+id/bottom_bar"
this will help you
try this
Please try as below code
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include
android:id="#+id/toolbar"
layout="#layout/toolbar"
android:layout_alignParentBottom="true"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#id/toolbar"
android:layout_alignParentTop="true"
android:orientation="vertical">
<View
android:layout_width="match_parent"
android:layout_height="6dp"
android:layout_marginTop="0dp"
android:background="#drawable/toolbar_dropshadow" />
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#fff"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff"
android:orientation="vertical" >
<TextView
android:id="#+id/text_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="20dp"
android:text="Name"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
<ImageView
android:id="#+id/image_full"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:padding="20dp"
android:scaleType="fitXY" />
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:scrollbars="none">
<LinearLayout
android:id="#+id/imageall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"></LinearLayout>
</HorizontalScrollView>
<TextView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="10dp"
android:background="#bcbcbc"></TextView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:orientation="vertical"
android:weightSum="2">
<TextView
android:id="#+id/price_full_offer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Price"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
<TextView
android:id="#+id/price_full"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text=""
android:textColor="#000"
android:textSize="12sp" />
</LinearLayout>
<fone.adipoli.shopping.Rounded_textview
android:id="#+id/circle_txt"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:layout_marginRight="70dp"
android:gravity="center"
android:padding="3dp"
android:text="" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="#bcbcbc"></TextView>
<TextView
android:id="#+id/stock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:layout_marginTop="10dp"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:layout_marginTop="10dp"
android:text="Check Availability"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
<TextView
android:id="#+id/item_available_cart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:text=""
android:textSize="12dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="3">
<EditText
android:id="#+id/enterpin"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="15dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:layout_weight="2"
android:background="#drawable/edittext_border"
android:cursorVisible="false"
android:hint="Enter Pincode"
android:inputType="number"
android:padding="5dp" />
<Button
android:id="#+id/pincheck"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center|right"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:background="#000"
android:text="Check"
android:textColor="#color/white" />
</LinearLayout>
<RelativeLayout
android:id="#+id/chnge_rl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="#+id/item_available"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:text=""
android:textSize="14dp" />
<TextView
android:id="#+id/change_pin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="50dp"
android:text="Change\nPincode"
android:textColor="#color/blue"
android:textSize="14dp" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:text="Description :\n"
android:textColor="#000"
android:textSize="18dp"
android:textStyle="bold" />
<RelativeLayout
android:id="#+id/des_rl"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="0dp"
android:orientation="vertical">
<WebView
android:id="#+id/text_des"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Full details"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
<RelativeLayout
android:id="#+id/bottom_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/blue"
android:orientation="horizontal"
android:weightSum="2" >
<Button
android:id="#+id/addtocart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/blue"
android:text="Add to Cart"
android:textColor="#color/white"
android:textStyle="bold" />
<TextView
android:layout_width="2dp"
android:layout_height="wrap_content"></TextView>
<Button
android:id="#+id/buynow"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/blue"
android:text="Buy Now "
android:textColor="#color/white"
android:textStyle="bold" />
</LinearLayout>
</RelativeLayout>
You should add tag android:layout_above="#id/bottom_bar" in your ScrollView
It will keep the scrolling above your bottom bar.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include
android:id="#+id/toolbar"
layout="#layout/toolbar" />
<View
android:layout_width="match_parent"
android:layout_height="6dp"
android:layout_marginTop="0dp"
android:background="#drawable/toolbar_dropshadow" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ScrollView
android:layout_above="#id/bottom_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#fff"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff"
android:orientation="vertical" >
<TextView
android:id="#+id/text_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="20dp"
android:text="Name"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
<ImageView
android:id="#+id/image_full"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:padding="20dp"
android:scaleType="fitXY" />
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:scrollbars="none">
<LinearLayout
android:id="#+id/imageall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"></LinearLayout>
</HorizontalScrollView>
<TextView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="10dp"
android:background="#bcbcbc"></TextView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:orientation="vertical"
android:weightSum="2">
<TextView
android:id="#+id/price_full_offer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Price"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
<TextView
android:id="#+id/price_full"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text=""
android:textColor="#000"
android:textSize="12sp" />
</LinearLayout>
<fone.adipoli.shopping.Rounded_textview
android:id="#+id/circle_txt"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:layout_marginRight="70dp"
android:gravity="center"
android:padding="3dp"
android:text="" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="#bcbcbc"></TextView>
<TextView
android:id="#+id/stock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:layout_marginTop="10dp"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:layout_marginTop="10dp"
android:text="Check Availability"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
<TextView
android:id="#+id/item_available_cart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:text=""
android:textSize="12dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="3">
<EditText
android:id="#+id/enterpin"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="15dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:layout_weight="2"
android:background="#drawable/edittext_border"
android:cursorVisible="false"
android:hint="Enter Pincode"
android:inputType="number"
android:padding="5dp" />
<Button
android:id="#+id/pincheck"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center|right"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:background="#000"
android:text="Check"
android:textColor="#color/white" />
</LinearLayout>
<RelativeLayout
android:id="#+id/chnge_rl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="#+id/item_available"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:text=""
android:textSize="14dp" />
<TextView
android:id="#+id/change_pin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="50dp"
android:text="Change\nPincode"
android:textColor="#color/blue"
android:textSize="14dp" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:text="Description :\n"
android:textColor="#000"
android:textSize="18dp"
android:textStyle="bold" />
<RelativeLayout
android:id="#+id/des_rl"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="0dp"
android:orientation="vertical">
<WebView
android:id="#+id/text_des"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Full details"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
<RelativeLayout
android:id="#+id/bottom_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/blue"
android:orientation="horizontal"
android:weightSum="2" >
<Button
android:id="#+id/addtocart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/blue"
android:text="Add to Cart"
android:textColor="#color/white"
android:textStyle="bold" />
<TextView
android:layout_width="2dp"
android:layout_height="wrap_content"></TextView>
<Button
android:id="#+id/buynow"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/blue"
android:text="Buy Now "
android:textColor="#color/white"
android:textStyle="bold" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
use it:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="#+id/ll"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include
android:id="#+id/toolbar"
layout="#layout/toolbar" />
<View
android:layout_width="match_parent"
android:layout_height="6dp"
android:layout_marginTop="0dp"
android:background="#drawable/toolbar_dropshadow" />
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#fff"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff"
android:orientation="vertical" >
<TextView
android:id="#+id/text_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="20dp"
android:text="Name"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
<ImageView
android:id="#+id/image_full"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:padding="20dp"
android:scaleType="fitXY" />
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:scrollbars="none">
<LinearLayout
android:id="#+id/imageall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"></LinearLayout>
</HorizontalScrollView>
<TextView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="10dp"
android:background="#bcbcbc"></TextView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:orientation="vertical"
android:weightSum="2">
<TextView
android:id="#+id/price_full_offer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Price"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
<TextView
android:id="#+id/price_full"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text=""
android:textColor="#000"
android:textSize="12sp" />
</LinearLayout>
<fone.adipoli.shopping.Rounded_textview
android:id="#+id/circle_txt"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:layout_marginRight="70dp"
android:gravity="center"
android:padding="3dp"
android:text="" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="#bcbcbc"></TextView>
<TextView
android:id="#+id/stock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:layout_marginTop="10dp"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:layout_marginTop="10dp"
android:text="Check Availability"
android:textAppearance="? android:attr/textAppearanceMedium"
android:textColor="#000" />
<TextView
android:id="#+id/item_available_cart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:text=""
android:textSize="12dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="3">
<EditText
android:id="#+id/enterpin"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="15dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:layout_weight="2"
android:background="#drawable/edittext_border"
android:cursorVisible="false"
android:hint="Enter Pincode"
android:inputType="number"
android:padding="5dp" />
<Button
android:id="#+id/pincheck"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center|right"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:background="#000"
android:text="Check"
android:textColor="#color/white" />
</LinearLayout>
<RelativeLayout
android:id="#+id/chnge_rl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="#+id/item_available"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:text=""
android:textSize="14dp" />
<TextView
android:id="#+id/change_pin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="50dp"
android:text="Change\nPincode"
android:textColor="#color/blue"
android:textSize="14dp" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:text="Description :\n"
android:textColor="#000"
android:textSize="18dp"
android:textStyle="bold" />
<RelativeLayout
android:id="#+id/des_rl"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="0dp"
android:orientation="vertical">
<WebView
android:id="#+id/text_des"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Full details"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
<RelativeLayout
android:id="#+id/bottom_bar"
android:layout_below:"#+id/ll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/blue"
android:orientation="horizontal"
android:weightSum="2" >
<Button
android:id="#+id/addtocart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/blue"
android:text="Add to Cart"
android:textColor="#color/white"
android:textStyle="bold" />
<TextView
android:layout_width="2dp"
android:layout_height="wrap_content"></TextView>
<Button
android:id="#+id/buynow"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/blue"
android:text="Buy Now "
android:textColor="#color/white"
android:textStyle="bold" />
</LinearLayout>
</RelativeLayout>
Remove XMLNS from your scrollView, Give an id to scroll view. Then add attribute android:layout_below to the next component which is coming after scroll view.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<include
android:id="#+id/toolbar"
layout="#layout/toolbar" />
<View
android:layout_width="match_parent"
android:layout_height="6dp"
android:layout_marginTop="0dp"
android:background="#drawable/toolbar_dropshadow" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#fff"
android:id="#+id/scrol_view"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#fff"
android:orientation="vertical" >
<TextView
android:id="#+id/text_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="20dp"
android:text="Name"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
<ImageView
android:id="#+id/image_full"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:padding="20dp"
android:scaleType="fitXY" />
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:scrollbars="none">
<LinearLayout
android:id="#+id/imageall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"></LinearLayout>
</HorizontalScrollView>
<TextView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="10dp"
android:background="#bcbcbc"></TextView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="3">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_weight="1"
android:orientation="vertical"
android:weightSum="2">
<TextView
android:id="#+id/price_full_offer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Price"
android:textAppearance="? android:attr/textAppearanceMedium"
android:textColor="#000" />
<TextView
android:id="#+id/price_full"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text=""
android:textColor="#000"
android:textSize="12sp" />
</LinearLayout>
<fone.adipoli.shopping.Rounded_textview
android:id="#+id/circle_txt"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:layout_marginRight="70dp"
android:gravity="center"
android:padding="3dp"
android:text="" />
</LinearLayout>
<TextView
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="#bcbcbc"></TextView>
<TextView
android:id="#+id/stock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:layout_marginTop="10dp"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:layout_marginTop="10dp"
android:text="Check Availability"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000" />
<TextView
android:id="#+id/item_available_cart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:text=""
android:textSize="12dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="3">
<EditText
android:id="#+id/enterpin"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="15dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:layout_weight="2"
android:background="#drawable/edittext_border"
android:cursorVisible="false"
android:hint="Enter Pincode"
android:inputType="number"
android:padding="5dp" />
<Button
android:id="#+id/pincheck"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center|right"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:background="#000"
android:text="Check"
android:textColor="#color/white" />
</LinearLayout>
<RelativeLayout
android:id="#+id/chnge_rl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="#+id/item_available"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="15dp"
android:text=""
android:textSize="14dp" />
<TextView
android:id="#+id/change_pin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="50dp"
android:text="Change\nPincode"
android:textColor="#color/blue"
android:textSize="14dp" />
</RelativeLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:text="Description :\n"
android:textColor="#000"
android:textSize="18dp"
android:textStyle="bold" />
<RelativeLayout
android:id="#+id/des_rl"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="0dp"
android:orientation="vertical">
<WebView
android:id="#+id/text_des"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Full details"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#000" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
<RelativeLayout
android:id="#+id/bottom_bar"
android:layout_below="#+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/blue"
android:orientation="horizontal"
android:weightSum="2" >
<Button
android:id="#+id/addtocart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/blue"
android:text="Add to Cart"
android:textColor="#color/white"
android:textStyle="bold" />
<TextView
android:layout_width="2dp"
android:layout_height="wrap_content"></TextView>
<Button
android:id="#+id/buynow"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/blue"
android:text="Buy Now "
android:textColor="#color/white"
android:textStyle="bold" />
</LinearLayout>
I have my xml file. It is a RelativeLayout with a ScrollView and inside the ScrollView I have LinearLayout and many more. The problem is that I can't reach the end of the view, as you can see it end with a "Sign Up" button... But my view is cut by the scroll and I can just see the middle of the button, the other middle is off screen.
So, any suggestions for how can I fix this? How can I work with the ScrollView so it wraps all of my content...
Check it:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/bg_signup"
android:orientation="vertical"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".SignUp">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:background="#xml/signup_round">
<LinearLayout
android:layout_width="260dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#xml/border_lines"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/new_signup" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:text="#string/signup"
android:textColor="#color/colorRB"
android:textSize="26sp"
android:textStyle="bold" />
</LinearLayout>
<EditText
android:id="#+id/first_name_EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:layout_marginTop="-25dp"
android:hint="#string/first_name"
android:textColor="#color/colorRB" />
<EditText
android:id="#+id/last_name_EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:hint="#string/last_name"
android:textColor="#color/colorRB" />
<EditText
android:id="#+id/email_EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:hint="#string/email"
android:inputType="textEmailAddress"
android:textColor="#color/colorRB" />
<EditText
android:id="#+id/email_confirmation_EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:hint="#string/email_confirmation"
android:inputType="textEmailAddress"
android:textColor="#color/colorRB" />
<EditText
android:id="#+id/password_EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:hint="#string/password"
android:inputType="textPassword"
android:textColor="#color/colorRB" />
<EditText
android:id="#+id/password_confirmation_EditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:hint="#string/password_confirmation"
android:inputType="textPassword"
android:textColor="#color/colorRB" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#xml/border_lines"
android:text="#string/sex"
android:textColor="#color/colorRB"
android:textSize="26sp"
android:textStyle="bold" />
<Spinner
android:id="#+id/sex_spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="-25dp"
android:entries="#array/sex_array" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#xml/border_lines"
android:text="#string/brithday"
android:textColor="#color/colorRB"
android:textSize="26sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-35dp"
android:orientation="horizontal">
<Button
android:id="#+id/birthdayBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:background="#color/fbutton_color_transparent"
android:onClick="showDatePickerDialog"
android:text="#string/birthdayBtn"
android:textAllCaps="false"
android:textColor="#color/colorRB" />
<Space
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
android:id="#+id/dateSelectedTv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:text="--/--/--"
android:textColor="#color/colorRB"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:paddingBottom="5dp"
android:text="#string/terms_conditions"
android:textColor="#color/colorRB"
android:textStyle="bold" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0" />
</LinearLayout>
<Button
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="5dp"
android:background="#xml/button_round"
android:onClick=""
android:text="#string/signup"
android:textColor="#color/white"
android:textStyle="bold" />
</LinearLayout>
</RelativeLayout>
</ScrollView>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick=""
android:src="#drawable/close_signup" />
</RelativeLayout>
I have a relative layout which contains two linear layouts. I want these two linear layouts to be placed in either halves of the relative layout containing them i.e. one to be positioned at top half and other at bottom half. Can anyone here help me with this. Here is the xml:
<RelativeLayout
android:id="#+id/updatedetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:orientation="vertical"
android:background="#drawable/oneeventbkg" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="#+id/Top_half_layout">
<ImageView
android:id="#+id/update_sn_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="10dp"
android:layout_marginTop="2dp" />
<TextView
android:id="#+id/update_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_margin="5dp"
android:textColor="#android:color/white"
android:textSize="14sp" />
<ImageView
android:id="#+id/update_message_pic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#id/update_sn_icon"
android:layout_marginLeft="10dp"
android:layout_marginTop="20dp" />
<TextView
android:id="#+id/update_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#id/update_message_pic"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:maxHeight="400dp"
android:scrollbars="vertical"
android:textColor="#android:color/white"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="#+id/bottom_half_layout">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:id="#+id/toggle_after"
android:visibility="invisible">
<TextView
android:id="#+id/toggle_like_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="10dp"
android:text="1000"
android:background="#android:color/transparent"
android:textColor="#android:color/white"
android:textSize="14sp" />
<ImageButton
android:id="#+id/toggle_like_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#android:color/transparent"
android:src="#drawable/xml_like_button_selctor" />
<TextView
android:id="#+id/toggle_comment_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="7dp"
android:text="100"
android:background="#android:color/transparent"
android:textColor="#android:color/white"
android:textSize="14sp" />
<ImageButton
android:id="#+id/toggle_comment_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#android:color/transparent"
android:src="#drawable/xml_comment_button_selector" />
</LinearLayout>
<ListView
android:id="#+id/likes_list"
android:layout_width="wrap_content"
android:layout_height="200dp"
android:layout_below="#id/toggle_after"
android:padding="20dp"
/>
<ListView
android:id="#+id/comments_list"
android:layout_width="wrap_content"
android:layout_height="200dp"
android:layout_below="#id/toggle_after"
android:padding="20dp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_below="#id/comments_list"
android:layout_marginBottom="10dp"
android:id="#+id/toggle_content"
android:layout_alignParentBottom="true">
<TextView
android:id="#+id/like_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="10dp"
android:text="1000"
android:background="#android:color/transparent"
android:textColor="#android:color/white"
android:textSize="14sp" />
<ImageButton
android:id="#+id/like_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#android:color/transparent"
android:src="#drawable/xml_like_button_selctor" />
<TextView
android:id="#+id/comment_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="7dp"
android:text="100"
android:background="#android:color/transparent"
android:textColor="#android:color/white"
android:textSize="14sp" />
<ImageButton
android:id="#+id/comment_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#android:color/transparent"
android:src="#drawable/xml_comment_button_selector" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
Try this..
<LinearLayout
android:id="#+id/updatedetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:orientation="vertical"
android:background="#drawable/oneeventbkg" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:id="#+id/Top_half_layout">
// Your Codes
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:id="#+id/bottom_half_layout">
// Your Codes
</LinearLayout>
</LinearLayout>
EDIT
<LinearLayout
android:id="#+id/updatedetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:orientation="vertical"
android:background="#drawable/oneeventbkg" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:id="#+id/Top_half_layout">
// Your Codes
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:id="#+id/bottom_half_layout">
// Your Codes
</RelativeLayout>
</LinearLayout>
// Try this way,hope this will help you to solve your problem...
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/updatedetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:background="#drawable/oneeventbkg" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:id="#+id/Top_half_layout"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/update_sn_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginLeft="10dp"
android:layout_marginTop="2dp" />
<TextView
android:id="#+id/update_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:textColor="#android:color/white"
android:layout_gravity="right"
android:textSize="14sp" />
</LinearLayout>
<ImageView
android:id="#+id/update_message_pic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="20dp" />
<TextView
android:id="#+id/update_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
android:maxHeight="400dp"
android:scrollbars="vertical"
android:textColor="#android:color/white"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:id="#+id/bottom_half_layout"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:id="#+id/toggle_after"
android:visibility="invisible">
<TextView
android:id="#+id/toggle_like_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="10dp"
android:text="1000"
android:background="#android:color/transparent"
android:textColor="#android:color/white"
android:textSize="14sp" />
<ImageButton
android:id="#+id/toggle_like_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#android:color/transparent"
android:src="#drawable/xml_like_button_selctor" />
<TextView
android:id="#+id/toggle_comment_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="7dp"
android:text="100"
android:background="#android:color/transparent"
android:textColor="#android:color/white"
android:textSize="14sp" />
<ImageButton
android:id="#+id/toggle_comment_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#android:color/transparent"
android:src="#drawable/xml_comment_button_selector" />
</LinearLayout>
<ListView
android:id="#+id/likes_list"
android:layout_width="wrap_content"
android:layout_height="200dp"
android:padding="20dp" />
<ListView
android:id="#+id/comments_list"
android:layout_width="wrap_content"
android:layout_height="200dp"
android:padding="20dp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:id="#+id/toggle_content">
<TextView
android:id="#+id/like_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="10dp"
android:text="1000"
android:background="#android:color/transparent"
android:textColor="#android:color/white"
android:textSize="14sp" />
<ImageButton
android:id="#+id/like_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#android:color/transparent"
android:src="#drawable/xml_like_button_selctor" />
<TextView
android:id="#+id/comment_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginLeft="7dp"
android:text="100"
android:background="#android:color/transparent"
android:textColor="#android:color/white"
android:textSize="14sp" />
<ImageButton
android:id="#+id/comment_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#android:color/transparent"
android:src="#drawable/xml_comment_button_selector" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
I have a layout for ldpi with some elements inside a scrowview.
I have two edittexts and when I click one of then, the keyboard
is overriding the edittext. Its haoening only in this screen and only in
this size of screnn. I have others layouts files with edittexts and It happens
only in this layout.
This is the code:
<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:orientation="vertical"
tools:context=".NovoCheckinActivity" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="67dp"
android:layout_weight="0.03"
android:background="#drawable/header"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="#+id/imgVoltaNovoCheckin"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="7dp"
android:layout_marginTop="13dp"
android:src="#drawable/bt_back"
android:onClick="voltaNovoCheckin"/>
<TextView
android:id="#+id/labelAutenticacaoNovoCheckin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/imgVoltaNovoCheckin"
android:layout_marginLeft="10dp"
android:layout_toRightOf="#+id/imgVoltaNovoCheckin"
android:text="Novo Check-in"
android:textColor="#android:color/white"
android:textSize="18sp" />
<TextView
android:id="#+id/tvEventoClienteNovoCheckin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/imgVoltaNovoCheckin"
android:layout_marginLeft="10dp"
android:layout_toRightOf="#+id/imgVoltaNovoCheckin"
android:text="Reuniao - Porto Seguro"
android:textColor="#android:color/white" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="8"
android:orientation="vertical" >
<ScrollView
android:layout_width="wrap_content"
android:layout_height="380dp" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="410dp"
android:focusableInTouchMode="true"
android:layout_weight="1.03" >
<TextView
android:id="#+id/labelTipoCheckin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="24dp"
android:layout_marginTop="5dp"
android:text="Tipo:"
android:textColor="#333333" />
<Button
android:id="#+id/btTipoCheckin"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_below="#+id/labelTipoCheckin"
android:layout_centerHorizontal="true"
android:layout_marginLeft="50dp"
android:layout_marginTop="2dp"
android:background="#drawable/borda_botao"
android:hint="Chegada/Saída/Presença" />
<Button
android:id="#+id/btLocal"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_below="#+id/labelLocal"
android:layout_centerHorizontal="true"
android:layout_marginLeft="50dp"
android:layout_marginTop="2dp"
android:background="#drawable/borda_botao"
android:hint="Empresa/Cliente/Minha Casa" />
<EditText
android:id="#+id/etObservacoesNovoCheckin"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_below="#+id/labelObservacoes"
android:layout_centerHorizontal="true"
android:layout_marginLeft="50dp"
android:layout_marginTop="2dp"
android:background="#drawable/borda_botao"
android:paddingLeft="5dp" >
</EditText>
<TextView
android:id="#+id/labelLocal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/labelTipoCheckin"
android:layout_below="#+id/btTipoCheckin"
android:text="Local:"
android:textColor="#333333" />
<EditText
android:id="#+id/etCustoNovoCheckin"
android:layout_width="match_parent"
android:layout_height="38dp"
android:layout_below="#+id/labelCustoNovoCheckin"
android:layout_centerHorizontal="true"
android:layout_marginLeft="50dp"
android:background="#drawable/borda_botao"
android:inputType="numberDecimal"
android:paddingLeft="5dp" />
<Button
android:id="#+id/btSalvarNovoCheckin"
android:layout_width="150dp"
android:layout_height="35dp"
android:layout_below="#+id/etCustoNovoCheckin"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:layout_weight="0.03"
android:background="#drawable/bt_green"
android:text="Salvar"
android:textColor="#android:color/white"
android:textSize="20sp" />
<TextView
android:id="#+id/labelObservacoes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/labelLocal"
android:layout_below="#+id/btLocal"
android:layout_marginTop="10dp"
android:text="Observações:"
android:textColor="#333333" />
<TextView
android:id="#+id/labelCustoNovoCheckin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/btCheck"
android:layout_below="#+id/btCheck"
android:layout_marginTop="10dp"
android:text="Custo:"
android:textColor="#333333" />
<ImageView
android:id="#+id/invisible"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_alignRight="#+id/labelTipoCheckin"
android:layout_alignTop="#+id/btCheck"
android:src="#drawable/invisible" />
<TextView
android:id="#+id/labelCheck"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/invisible"
android:layout_marginTop="5dp"
android:layout_toRightOf="#+id/labelCustoNovoCheckin"
android:text="Último Check-in do evento?"
android:textSize="13sp" />
<ImageView
android:id="#+id/btCheck"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_alignRight="#+id/invisible"
android:layout_below="#+id/etObservacoesNovoCheckin"
android:layout_marginTop="10dp"
android:background="#drawable/btunchecked" />
</RelativeLayout>
</ScrollView>
</LinearLayout>
take a look at the activity android:windowSoftInputMode modes to help with your adjustment of items on screen