I am trying to build a searchbar over a full screen image slider who can be scrolled.
Image 1
But when i am scrolling down, my logo and searchbar are scrolled too.
Image 2
How can i do to be fixed even i scroll down or not?
This is my xml file. I need that imageslider to be fullscreen when i open the activity.
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout 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"
android:fitsSystemWindows="true">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.denzcoskun.imageslider.ImageSlider
android:id="#+id/slider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:iss_auto_cycle="true"
app:iss_corner_radius="5"
app:iss_delay="0"
app:iss_period="1000">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:layout_width="60dp"
android:layout_height="80dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:src="#drawable/logo" />
<SearchView
android:id="#+id/search_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="#string/searchint"
android:background="#drawable/bg_round"
android:queryBackground="#color/transparent"
android:queryHint="SEARCH PRODUCTS"
android:theme="#style/SearchViewStyle" />
</LinearLayout>
</com.denzcoskun.imageslider.ImageSlider>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<EditText
android:id="#+id/emaillogare"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:autofillHints="#string/email"
android:drawableStart="#drawable/email"
android:drawablePadding="10sp"
android:ems="10"
android:hint="#string/email"
android:inputType="textEmailAddress"
android:maxLines="1"
android:padding="20sp"
android:textColor="#color/white"
android:textColorHint="#color/white" />
<EditText
android:id="#+id/logareparola"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:autofillHints="#string/parola"
android:drawablePadding="10sp"
android:ems="10"
android:hint="#string/parola"
android:inputType="textPassword"
android:maxLines="1"
android:padding="20sp"
android:textColor="#color/white"
android:textColorHint="#color/white" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:buttonTint="#color/white"
android:paddingStart="30sp"
android:textColor="#color/white" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</androidx.drawerlayout.widget.DrawerLayout>
Separate your search bar such that it resides outside of the ScrollView.
<ParentLayout>
<LayoutContainingSearchBar>
---- Search Bar related items
</LayoutContainingSearchBar>
<SrollView>
---- Scrollable Area
</SrollView>
</ParentLayout>
Try the code below and if the problem persists, let me know.
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout 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"
android:fitsSystemWindows="true">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<SearchView
android:id="#+id/search_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="#string/searchint"
android:background="#drawable/bg_round"
android:queryBackground="#color/transparent"
android:queryHint="SEARCH PRODUCTS"
android:theme="#style/SearchViewStyle" />
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.denzcoskun.imageslider.ImageSlider
android:id="#+id/slider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:iss_auto_cycle="true"
app:iss_corner_radius="5"
app:iss_delay="0"
app:iss_period="1000">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:layout_width="60dp"
android:layout_height="80dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:src="#drawable/logo" />
</LinearLayout>
</com.denzcoskun.imageslider.ImageSlider>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<EditText
android:id="#+id/emaillogare"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:autofillHints="#string/email"
android:drawableStart="#drawable/email"
android:drawablePadding="10sp"
android:ems="10"
android:hint="#string/email"
android:inputType="textEmailAddress"
android:maxLines="1"
android:padding="20sp"
android:textColor="#color/white"
android:textColorHint="#color/white" />
<EditText
android:id="#+id/logareparola"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:autofillHints="#string/parola"
android:drawablePadding="10sp"
android:ems="10"
android:hint="#string/parola"
android:inputType="textPassword"
android:maxLines="1"
android:padding="20sp"
android:textColor="#color/white"
android:textColorHint="#color/white" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:buttonTint="#color/white"
android:paddingStart="30sp"
android:textColor="#color/white" />
</LinearLayout>
</LinearLayout>
</androidx.drawerlayout.widget.DrawerLayout>
Feel free to ask if something is unclear.
Related
I know this is common to ask but I'm having a trouble on how can I place the change password button beside edit button like the example image below, I tried app:layout_constraintLeft_toLeftOf="id" but it doesn't work, Is there anyway how can I manage in layout, I've keep searching till yet not found the answer, need help
**activity_main.xml **
<?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:id="#+id/activity_profile"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".EditProfile">
<ScrollView
android:id="#+id/scrolView_account"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="#+id/linear_account"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<View
android:id="#+id/view"
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginBottom="50dp"
android:background="#color/primary" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="100dp"
android:padding="5dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginTop="50dp"
android:layout_marginRight="10dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:padding="10dp"
android:id="#+id/txtProfileDetails"
android:text="Profile Details"
android:textStyle="bold" />
<Button
android:layout_width="45dp"
android:layout_height="wrap_content"
android:layout_gravity="right"
app:layout_constraintLeft_toLeftOf="parent"
android:padding="10dp"
android:layout_marginRight="10dp"
android:id="#+id/editProfile"
android:drawableLeft="#drawable/ic_edit"
android:textStyle="bold" />
<Button
android:layout_width="205dp"
android:layout_height="wrap_content"
android:layout_gravity="right"
app:layout_constraintLeft_toLeftOf="parent"
android:padding="10dp"
android:layout_marginRight="10dp"
android:id="#+id/editPassword"
android:text="Change Password"
android:textStyle="bold" />
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/cc_idno"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:helperText="Mandatory"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
app:helperTextTextColor="#color/validation"
app:startIconDrawable="#drawable/ic_series"
android:layout_below="#+id/txtProfileDetails"
style="#style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="ID number"
android:id="#+id/edt_idno"
android:inputType="text"
android:layout_below="#id/edtFirstname"/>
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginTop="30dp">
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/imageview_account_profile"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:src="#drawable/user_logo"
app:civ_border_color="#FFFFFF"
app:civ_border_width="2dp" />
<com.google.android.material.textfield.TextInputLayout
android:id="#+id/floatingActionButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="#+id/imageview_account_profile"
android:layout_alignParentTop="true"
android:layout_marginTop="10dp" />
</RelativeLayout>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
Wrap your both the concerned buttons inside a linearlayout and it will work. with horizontal orientation .
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right">
<Button
android:id="#+id/editPassword"
android:layout_width="205dp"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginRight="10dp"
android:padding="10dp"
android:text="Change Password"
android:textStyle="bold"
/>
<Button
android:id="#+id/editProfile"
android:layout_width="45dp"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginRight="10dp"
android:padding="10dp"
android:textStyle="bold"
/>
</LinearLayout>
I need to build a searchview who is fixed on top of the page.
When i scroll down my searchview is overlapped by a imageslider Image 1 all i need to do is to be always in front to be visible.
I tried everything but always my searchview is in the back of other objects. Any suggestions?
This is my xml file.
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout 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"
android:fitsSystemWindows="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:layout_width="60dp"
android:layout_height="80dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:src="#drawable/logo" />
<SearchView
android:id="#+id/search_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="#string/searchint"
android:background="#drawable/bg_round"
android:queryBackground="#color/transparent"
android:queryHint="SEARCH PRODUCTS"
android:theme="#style/SearchViewStyle" />
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
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">
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:autofillHints="#string/email"
android:drawableStart="#drawable/email"
android:drawablePadding="10sp"
android:ems="10"
android:hint="#string/email"
android:inputType="textEmailAddress"
android:maxLines="1"
android:padding="20sp"
android:textColor="#color/white"
android:textColorHint="#color/white" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:autofillHints="#string/parola"
android:drawablePadding="10sp"
android:ems="10"
android:hint="#string/parola"
android:inputType="textPassword"
android:maxLines="1"
android:padding="20sp"
android:textColor="#color/white"
android:textColorHint="#color/white" />
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:buttonTint="#color/white"
android:paddingStart="30sp"
android:textColor="#color/white" />
</LinearLayout>
<com.denzcoskun.imageslider.ImageSlider
android:id="#+id/slider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:iss_auto_cycle="true"
app:iss_corner_radius="5"
app:iss_delay="0"
app:iss_period="1000"></com.denzcoskun.imageslider.ImageSlider>
</LinearLayout>
</ScrollView>
</androidx.drawerlayout.widget.DrawerLayout>
You can use elevation to make it at top of other elements
Solution Code:
<SearchView
android:id="#+id/search_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="#string/searchint"
android:background="#drawable/bg_round"
android:queryBackground="#color/transparent"
android:elevation="20dp"
android:queryHint="SEARCH PRODUCTS"
android:theme="#style/SearchViewStyle" />
For instance, I used 20dp, you use your preferred value instead.
Feel free to ask if something is unclear.
I have developing android app.
I have problem when displaying list of card in recycler-view that within in fragment_auction_products.xml.
When I navigate to FragmentAuctionProducts, I have the
this is the problem
As you can see my list starts showing after 50% space is empty... How I can solve this?
My fragment_auction_products.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="top"
android:gravity="top"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/home_auction_products_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="top"
android:gravity="top"
android:layout_marginTop="10dp"/>
<ProgressBar
android:id="#+id/home_auction_products_loader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:indeterminateDrawable="#drawable/spinner_ring"
android:indeterminateOnly="true" />
</LinearLayout>
My recycler view item:
<?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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginStart="15dp"
android:layout_marginEnd="10dp"
android:gravity="center"
android:background="#drawable/layer_shadow"
android:orientation="horizontal">
<ImageView
android:id="#+id/home_auction_products_recycler_view_image"
android:layout_margin="4dp"
android:layout_width="125dp"
android:layout_height="150dp"
android:src="#drawable/card_example_1" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:layout_marginStart="15dp"
android:layout_marginEnd="10dp"
android:orientation="vertical"
android:paddingTop="15dp">
<TextView
android:id="#+id/home_auction_products_recycler_view_title"
style="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/muli_bold"
android:text="Title"
android:textColor="#color/colorBlack"
android:textSize="14dp" />
<TextView
android:id="#+id/home_auction_products_recycler_view_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/muli_bold"
android:text="id"
android:textColor="#color/colorBlack"
android:textSize="0dp" />
<TextView
android:id="#+id/home_auction_products_recycler_view_current_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/muli_bold"
android:text="50000 тг"
android:textColor="#color/colorTextYellow"
android:textSize="16dp" />
<TextView
android:id="#+id/home_auction_products_recycler_view_start_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/muli"
android:text="start-price"
android:textColor="#color/colorBlack"
android:textSize="12dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="8dp"
android:background="#drawable/auction_products_shape"
android:gravity="center"
android:orientation="vertical"
android:paddingLeft="4dp"
android:paddingTop="2dp"
android:paddingRight="4dp"
android:paddingBottom="2dp">
<TextView
android:id="#+id/home_auction_products_recycler_view_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="#font/muli"
android:gravity="center"
android:text="10"
android:textColor="#color/colorWhite"
android:textSize="14dp"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="#font/muli"
android:gravity="center"
android:text="ДНЕЙ"
android:textColor="#color/colorWhite"
android:textSize="6dp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#drawable/auction_products_shape"
android:gravity="center"
android:orientation="vertical"
android:paddingLeft="4dp"
android:paddingTop="2dp"
android:paddingRight="4dp"
android:paddingBottom="2dp">
<TextView
android:id="#+id/home_auction_products_recycler_view_hour"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="#font/muli"
android:gravity="center"
android:text="12"
android:textColor="#color/colorWhite"
android:textSize="14dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="#font/muli"
android:gravity="center"
android:text="ЧАСОВ"
android:textColor="#color/colorWhite"
android:textSize="6dp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end"
android:orientation="horizontal">
<TextView
android:id="#+id/home_auction_products_recycler_view_show"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/ic_mdi_keyboard_arrow_right"
android:fontFamily="#font/muli"
android:textColor="#color/colorTextGray"
android:textSize="12dp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
My main container where I call my fragments:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/colorWhite"
tools:context=".activity.MainActivity">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#id/bottom_nav_bar">
<FrameLayout
android:id="#+id/main_fragment_container"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</ScrollView>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="#+id/bottom_nav_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="?android:windowBackground"
app:menu="#menu/menu" />
</RelativeLayout>
Change the FrameLayout height to match_parent.
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#id/bottom_nav_bar">
<FrameLayout
android:id="#+id/main_fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</ScrollView>
Just use android:layout_alignParentTop.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/home_auction_products_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="top"
android:gravity="top"
android:layout_marginTop="10dp"/>
<ProgressBar
android:id="#+id/home_auction_products_loader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:indeterminateDrawable="#drawable/spinner_ring"
android:indeterminateOnly="true" />
</LinearLayout>
Hope this helps.
I'm developing an Android app.
As you can see in the attached screenshot, I have an ImageView in a small size. I load it by Picasso library. Now, I'd like to enlarge it by onClick event in a new ImageView more large (id: enlarge_image, in .XML) . I looked for a solution everywhere, also throught the Android site's guide, but I don't know how to do implement it. Can anyone help me? Thanks.
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:andorid="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
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/viewA"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.65"
android:orientation="horizontal">
<ImageView
android:id="#+id/img_poster_film"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:scaleType="centerCrop"
app:srcCompat="#drawable/ic_star_rate_black_18dp" />
</LinearLayout>
<LinearLayout
android:id="#+id/viewB"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.4"
android:orientation="vertical"
android:padding="8dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="5dp">
<TextView
android:id="#+id/index_title"
style="#style/reference_index"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="#string/title_film" />
<TextView
android:id="#+id/original_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="#color/title_color"
android:textSize="20dp" />
</LinearLayout>
<View style="#style/separator" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp">
<TextView
style="#style/reference_index"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/genres_film" />
<TextView
android:id="#+id/genres_film"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingTop="8dp">
<TextView
style="#style/reference_index"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/date_release_film" />
<TextView
android:id="#+id/date_release_film"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"/>
<TextView
style="#style/reference_index"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="35dp"
android:layout_marginStart="35dp"
android:text="#string/duration_film" />
<TextView
android:id="#+id/duration_film"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp" />
</LinearLayout>
<View style="#style/separator" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="10dp">
<TextView
style="#style/reference_index"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="#string/overview_film" />
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/overview_film"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:layout_marginTop="5dp"
android:textStyle="italic" />
</LinearLayout>
</ScrollView>
</LinearLayout>
</LinearLayout>
<android.support.design.widget.FloatingActionButton
android:id="#+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:backgroundTint="#color/light_azure"
android:clickable="true"
android:src="#drawable/ic_star_rate_black_18dp"
app:layout_anchor="#id/viewA"
app:layout_anchorGravity="bottom|right|end" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="20dp">
<ImageView
android:id="#+id/enlarged_image"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
I have a layout, in which I need that the top header should should not hide when I open softKeyBoard. I am using Fragment here.I am using recylerView.
when i am opening softkeyboard the top header is scrolling up. I need that header to stay there and Recyclerview to scroll.
Below is my xml.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/rel_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/bggradient">
<RelativeLayout
android:id="#+id/rel_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="#drawable/drawable_below_line">
<ImageView
android:id="#+id/iv_menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/txtSettingHeader"
android:layout_alignTop="#+id/txtSettingHeader"
android:layout_centerVertical="true"
android:background="#drawable/button_selector"
android:onClick="onClickEvent"
android:padding="10dp"
android:src="#mipmap/ic_back" />
<TextView
android:id="#+id/txtUserName"
style="#style/FragHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true" />
<ImageView
android:id="#+id/iv_userImage"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/txtUserName"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/txtUserName"
android:layout_centerVertical="true"
android:onClick="onViewClick"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:src="#mipmap/ic_male" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/lin_comment"
android:layout_below="#+id/rel_header"
android:gravity="top"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="#+id/RecyelerViewChat"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible">
</android.support.v7.widget.RecyclerView>
<TextView
android:id="#+id/tv_txtNoRecords"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:minHeight="100dp"
android:text="#string/txtNoChat"
android:textColor="#android:color/white"
android:visibility="gone" />
</LinearLayout>
<LinearLayout
android:id="#+id/lin_comment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#70FFFFFF"
android:gravity="center"
android:orientation="horizontal"
android:padding="5dp">
<LinearLayout
android:id="#+id/linEditComment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:focusableInTouchMode="true"
android:orientation="horizontal">
<ImageView
android:id="#+id/iv_imgToggleKeyboardEmoji"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:clickable="true"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:src="#mipmap/ic_emoji" />
<com.lawo.emojicon.EmojiconEditText
android:id="#+id/et_edtChat"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/drawable_black_border"
android:hint="#string/hintTypeMessage"
android:inputType="textNoSuggestions|textMultiLine"
android:maxLength="500"
android:maxLines="3"
android:padding="10dp"
android:textColor="#android:color/black"
android:textColorHint="#android:color/darker_gray" />
</LinearLayout>
<ImageView
android:id="#+id/iv_imgSend"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:onClick="onClickEvent"
android:padding="10dp"
android:src="#mipmap/ic_sent" />
</LinearLayout>
</RelativeLayout>
Add the following to your "activity" tag in AndroidManifest.xml:
android:windowSoftInputMode="adjustResize"
Reference: Specify How Your UI Should Respond.