So, basically I am implementing drawerLayout with custom menu (I am using recyclerView instead of navigationView). Top padding is appearing if I run the app in latest version of android (> lollipop). Is there anyway to remove the top padding? I tried to set fitSystemWindows=true on drawerLayout but no avail.
Code
<android.support.v4.widget.DrawerLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<include
layout="#layout/app_bar_store_landing"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#color/drawer_bg"
android:paddingLeft="20dp">
<ImageView
android:id="#+id/menuIcon"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_centerVertical="true"
android:src="#drawable/location_menu"
android:layout_marginRight="10dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_centerVertical="true"
android:layout_toRightOf="#+id/menuIcon">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Jalan Tunku Ismail"
android:textColor="#android:color/white"
android:ellipsize="end"
android:singleLine="true"
android:textStyle="bold"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Tap to change location"
android:textColor="#color/grey_text" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#color/drawer_bg"
android:paddingLeft="20dp">
<ImageView
android:id="#+id/menuIcon2"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_centerVertical="true"
android:src="#drawable/store_menu"
android:layout_marginRight="10dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_centerVertical="true"
android:layout_toRightOf="#+id/menuIcon2">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Jaya Grocer, Kuala Lumpur"
android:textColor="#android:color/white"
android:ellipsize="end"
android:singleLine="true"
android:textStyle="bold"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Tap to change store"
android:textColor="#color/grey_text" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#color/drawer_bg"
android:paddingLeft="20dp">
<ImageView
android:id="#+id/menuIcon3"
android:layout_width="35dp"
android:layout_height="35dp"
android:src="#drawable/my_account"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_centerVertical="true"
android:layout_toRightOf="#+id/menuIcon3">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="My Account"
android:textColor="#android:color/white"
android:ellipsize="end"
android:singleLine="true"
android:textStyle="bold"/>
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="#color/drawer_bg"
android:paddingLeft="20dp">
<ImageView
android:id="#+id/menuIcon4"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_centerVertical="true"
android:src="#drawable/my_shopping_list"
android:layout_marginRight="10dp"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_centerVertical="true"
android:layout_toRightOf="#+id/menuIcon4">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="My Shopping List"
android:textColor="#android:color/white"
android:ellipsize="end"
android:singleLine="true"
android:textStyle="bold"/>
</LinearLayout>
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#color/grey_text" />
<android.support.v7.widget.RecyclerView
android:id="#+id/menuList"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.v4.widget.DrawerLayout>
Screenshot:
Left - Lolliop, Right - Kitkat
Fixed!
Remove android:fitsSystemWindows="true" in NestedScrollView resolves the problem.
OK, found the bug. The culprit is android:fitsSystemWindows="true" in NestedScrollView. Remove this line and it resolves my problem. I am wondering why it is not affecting older version of android (< Kitkat).
Related
Like in title. Layout looks great on Android Studio, but when I get it on real device it looks bad. The JavaCameraView takes only half of the screen while in Android Studio takes about 3/4 as it should be. JavaCameraView should reach horizontal bar shown on screen.
Here are my screenshots.
On Android Studio:
On real device:
Layout Inspector shows that this RelativeLayout that hosts JavaCameraView occupies all that space but JavaCameraView with height:match_parent not behaves like that:
Why is that so?
Here is my layout:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:opencv="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="5"
android:layout_above="#+id/scroll_view">
<org.opencv.android.JavaCameraView
android:id="#+id/java_surface_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
opencv:camera_id="any"
opencv:show_fps="true" />
</RelativeLayout>
<ScrollView
android:id="#+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginBottom="?actionBarSize">
<RelativeLayout
android:id="#+id/rl"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<View
android:id="#+id/View1"
android:layout_width="wrap_content"
android:layout_height="2dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:background="#android:color/darker_gray" />
<TextView
android:id="#+id/alert_pxcm_too_small"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/View1"
android:layout_centerHorizontal="true"
android:gravity="center_horizontal"
android:textColor="#FF0000"
android:textSize="#dimen/text_size_rest"
android:visibility="visible" />
<Spinner
android:id="#+id/spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:layout_below="#id/alert_pxcm_too_small"/>
<TextView
android:id="#+id/measurements_width_converter"
android:layout_marginTop="15dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/spinner"
android:layout_centerHorizontal="true"
android:gravity="center_horizontal"
android:textColor="#0000FF"
android:text="#string/width_info"
android:textSize="#dimen/text_size_rest"
android:visibility="visible" />
<TextView
android:id="#+id/measurements_height_converter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/measurements_width_converter"
android:layout_centerHorizontal="true"
android:gravity="center_horizontal"
android:textColor="#0000FF"
android:text="#string/width_info"
android:textSize="#dimen/text_size_rest"
android:visibility="visible" />
</RelativeLayout>
</ScrollView>
If you need something more just ask. Probably you will need also some Java code of classes, this fragment etc. Thank you in advance! :)
Your problem is on the value you're using in android:layout_weight and how you're set the android:layout_width and android:layout_height.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
...
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.3"
..
>
<org.opencv.android.JavaCameraView
android:layout_width="match_parent"
android:layout_height="match_parent"
..
/>
</RelativeLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.7"
<!-- Other views here -->
</ScrollView>
</LinearLayout>
Here is the working correctly layout:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:opencv="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_marginBottom="?actionBarSize">
<org.opencv.android.JavaCameraView
android:id="#+id/java_surface_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/scroll_view"
android:layout_alignParentTop="true"
opencv:camera_id="any"
opencv:show_fps="true" />
<ScrollView
android:id="#+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_alignParentBottom="true">
<RelativeLayout
android:id="#+id/rl"
android:layout_width="match_parent"
android:layout_height="150dp">
<View
android:id="#+id/View1"
android:layout_width="wrap_content"
android:layout_height="2dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:background="#android:color/darker_gray" />
<TextView
android:id="#+id/alert_pxcm_too_small"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/View1"
android:layout_centerHorizontal="true"
android:gravity="center_horizontal"
android:textColor="#FF0000"
android:textSize="#dimen/text_size_rest"
android:visibility="visible" />
<Spinner
android:id="#+id/spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/alert_pxcm_too_small"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp" />
<TextView
android:id="#+id/measurements_width_converter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/spinner"
android:layout_centerHorizontal="true"
android:layout_marginTop="15dp"
android:gravity="center_horizontal"
android:text="#string/width_info"
android:textColor="#0000FF"
android:textSize="#dimen/text_size_rest"
android:visibility="visible" />
<TextView
android:id="#+id/measurements_height_converter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/measurements_width_converter"
android:layout_centerHorizontal="true"
android:gravity="center_horizontal"
android:text="#string/width_info"
android:textColor="#0000FF"
android:textSize="#dimen/text_size_rest"
android:visibility="visible" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>
Currently I'm trying to get the custom ring progress bars to display properly on an android sdk level 23 and below. They work perfectly on android SDK 25+.
Im using a custom library for circular progress bars found here: https://github.com/HotBitmapGG/RingProgressBar, above android lolipop, the layout looks like this:
SDK 23+
however on android lolipop the scrollView seen below breaks the rings so that they dont show up:
android SDK <23
If i remove the scroll view below the progress bars they start working again and I have no idea why that is so. Also if I call View.GONE() on one of the relative layouts the Rings show up again. I'm fairly certain this is because the scrollView is not being used as everything fits on the screen.
Here is my XML: (the middle section is pretty repetative)
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
>
<android.support.v4.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/swipeRefresh"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:background="#color/Background"
android:theme="#android:style/Theme.Black.NoTitleBar"
android:fillViewport="true">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:background="#color/Background"
>
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="#color/colorPrimary"
android:elevation="10dp"
android:minHeight="#dimen/Toolbar_Height"
android:uiOptions="splitActionBarWhenNarrow"/>
<!--Average-->
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".Average"
android:id="#+id/relativeLayoutAverage"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="5"
android:background="#color/Background"
android:paddingBottom="5dp"
android:paddingTop="0dp"
android:paddingEnd="50dp"
android:paddingStart="50dp"
android:layout_marginBottom="10dp"
android:minHeight="#dimen/Average_Row_Height"
>
<TextView
android:id="#+id/AverageText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true"
android:background="#drawable/circle"
android:fontFamily="#font/roboto_mono"
android:text="#string/Average"
android:textColor="#color/AverageTextColor"
android:textSize="16sp"
android:textStyle="bold"
android:paddingTop="2dp"
/>
<io.netopen.hotbitmapgg.library.view.RingProgressBar
android:id="#+id/AverageBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="115dp"
android:layout_below="#id/AverageText"
android:layout_marginTop="5dp"
android:elevation="15dp"
app:max="101"
app:ringDiameter="115"
app:ringColor="#android:color/transparent"
app:ringProgressColor="#color/AverageBarColor"
app:ringWidth="12dp"
app:style="STROKE"
app:textColor="#color/TextColor"
app:textIsShow="false"
app:textSize="26sp" />
<TextView
android:id="#+id/AverageInt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/AverageText"
android:layout_centerHorizontal="true"
android:fontFamily="#font/roboto"
android:layout_marginTop="47dp"
android:text=""
android:textColor="#color/TextColor"
android:textSize="20sp"
android:textStyle="bold" />
</RelativeLayout>
<!--Ta buttons-->
<!--Button 1-->
<RelativeLayout
android:id="#+id/relativeLayout"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/button_bg_rectangle_solid"
android:minHeight="#dimen/Row_Height"
android:clickable="true"
android:elevation="3dp"
android:layout_marginTop="0dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="4dp"
>
<TextView
android:id="#+id/Period"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:textStyle="normal"
android:fontFamily="#font/roboto_mono"
android:layout_marginTop="3dp"
android:textSize="20sp"
android:text="Period 1:"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:textColor="#color/SecondaryTextColor"
/>
<TextView
android:id="#+id/RoomNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/Period"
android:textStyle="normal"
android:fontFamily="#font/roboto_mono"
android:layout_marginTop="3dp"
android:textSize="15sp"
android:text=""
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:textColor="#color/TextColor"
/>
<TextView
android:id="#+id/EmptyCourse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/RoomNumber"
android:layout_marginEnd="100dp"
android:gravity="start"
android:layout_marginStart="15dp"
android:layout_centerHorizontal="false"
android:text=""
android:textStyle="bold"
android:textSize="16sp"
/>
<io.netopen.hotbitmapgg.library.view.RingProgressBar
android:id="#+id/SubjectBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_alignParentStart="true"
android:layout_marginStart="10dp"
android:elevation="5dp"
app:max="101"
app:ringColor="#android:color/transparent"
app:ringDiameter="90"
app:ringProgressColor="#color/BarColor1"
app:ringWidth="9dp"
app:style="STROKE"
app:textColor="#color/TextColor"
app:textIsShow="false"
app:textSize="16sp" />
<TextView
android:id="#+id/SubjectInt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignStart="#id/SubjectBar"
android:fontFamily="#font/roboto"
android:layout_marginStart="20dp"
android:text=""
android:textColor="#color/TextColor"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="#+id/SubjectAbrv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="false"
android:layout_alignParentEnd="true"
android:layout_marginEnd="30dp"
android:layout_marginTop="25dp"
android:text=""
android:textColor="#color/TextColor"
android:textSize="15sp"
android:fontFamily="#font/roboto"
android:textStyle="bold" />
<TextView
android:id="#+id/SubjectName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/SubjectAbrv"
android:layout_alignStart="#id/SubjectAbrv"
android:layout_marginEnd="5dp"
android:layout_marginTop="5dp"
android:text=""
android:textColor="#color/SecondaryTextColor"
android:textSize="15sp"
android:fontFamily="#font/roboto"
android:textStyle="italic" />
</RelativeLayout>
<!--The same thing repeated another 3 times below......-->
</LinearLayout>
</ScrollView>
</android.support.v4.widget.SwipeRefreshLayout>
<FrameLayout
android:id="#+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<android.support.design.widget.NavigationView
android:id="#+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="#layout/nav_header_main_drawer"
app:menu="#menu/activity_main_drawer" />
</android.support.v4.widget.DrawerLayout>
If anyone knows why this happens id love to know! Thanks in advance.
Nvm found a workarround. For those that are having the same problem: hardcoding the android:layout_height to a specific dp value should solve the problem.
In our chat app new message start first. For see old message user scroll up. For this we set reverseLayout true.
Ex: LayoutManager reverse so 0 position is botttom. when user scroll for old message suppose position is 10 . so i want to hide toolbar.when user go below from 10 position to 9 position i want to show toolbar.
LinearLayoutManager linearLayoutManager = new WrapContentLinearLayoutManager(context);
linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
linearLayoutManager.setReverseLayout(true);
We want to hide collapsing toolbar when user scroll up for fetch old message and show collapsing toolbar when user scroll down.
Any hints on how to achieve this?
XML Code as below :
<?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/rlMain"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/whole_background_color"
android:orientation="vertical">
<ImageView
android:id="#+id/ivBackgroundWall"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop" />
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/rlChatMessageSendView">
<android.support.design.widget.AppBarLayout
android:id="#+id/app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#00000000"
app:elevation="0dp">
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|enterAlways">
<include
android:id="#+id/rlZoneDetail"
layout="#layout/include_layout_zone_option" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_behavior="com.gochat.uIUtil.FixScrollingFooterBehavior">
<RelativeLayout
android:id="#+id/rel_root_recyclerview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/rlChat"
android:paddingBottom="#dimen/margin_five">
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerViewChat"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:overScrollMode="never"
android:scrollbars="none"
android:visibility="visible"
tools:listitem="#layout/chat_adapter_message_layout" />
<ProgressBar
android:id="#+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:theme="#style/AppTheme.ProgressBarColor"
android:visibility="gone" />
<android.support.v7.widget.AppCompatTextView
android:id="#+id/tvFollow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="#dimen/padding_five"
android:layout_marginTop="#dimen/padding_ten"
android:background="#drawable/background_login_signup_small_radius"
android:gravity="center"
android:maxLines="1"
android:paddingBottom="#dimen/padding_five"
android:paddingLeft="#dimen/padding_twenty"
android:paddingRight="#dimen/padding_twenty"
android:paddingTop="#dimen/padding_five"
android:singleLine="true"
android:text="#string/start_follow"
android:textAllCaps="false"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/white"
android:textSize="#dimen/text_size_fifteen"
android:visibility="gone" />
<LinearLayout
android:id="#+id/llAnnounce"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/recyclerViewChat"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="#dimen/padding_five"
android:layout_marginRight="#dimen/padding_five"
android:layout_marginTop="#dimen/padding_five"
android:background="#drawable/background_login_signup_small_radius"
android:gravity="center"
android:visibility="gone">
<ImageView
android:layout_width="#dimen/padding_thirteen"
android:layout_height="#dimen/padding_thirteen"
android:layout_marginLeft="#dimen/margin_seven"
android:layout_marginStart="#dimen/margin_seven"
android:src="#drawable/iv_white_shout" />
<android.support.v7.widget.AppCompatTextView
android:id="#+id/tvAnnouncement"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="#dimen/margin_twenty"
android:layout_marginLeft="#dimen/margin_ten"
android:layout_marginRight="#dimen/margin_twenty"
android:layout_marginStart="#dimen/margin_ten"
android:gravity="center"
android:maxLines="1"
android:paddingBottom="#dimen/padding_five"
android:paddingTop="#dimen/padding_five"
android:singleLine="true"
android:text="#string/announce_text"
android:textAllCaps="false"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/white"
android:textSize="#dimen/text_size_thirteen"
android:visibility="visible" />
<ImageView
android:layout_width="#dimen/padding_thirteen"
android:layout_height="#dimen/padding_thirteen"
android:layout_marginEnd="#dimen/margin_seven"
android:layout_marginRight="#dimen/margin_seven"
android:src="#drawable/iv_white_send" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:id="#+id/rlChat"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_gravity="bottom"
android:background="#color/bg_bottombar"
android:orientation="vertical"
android:visibility="visible"
app:layout_behavior="com.gochat.uIUtil.FixScrollingFooterBehavior">
<View
android:layout_width="match_parent"
android:layout_height="#dimen/onedp"
android:background="#color/create_zone_divider_color_whatsapp" />
<RelativeLayout
android:id="#+id/rl_send_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/bottom_tab"
android:padding="#dimen/padding_seven"
android:visibility="visible">
<RelativeLayout
android:id="#+id/rlAdd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:paddingBottom="#dimen/padding_ten"
android:paddingRight="#dimen/margin_eight"
android:paddingTop="#dimen/padding_ten">
<ImageView
android:id="#+id/ivAdd"
android:layout_width="#dimen/margin_twenty"
android:layout_height="#dimen/margin_twenty"
android:layout_centerVertical="true"
android:src="#drawable/iv_add_blue" />
</RelativeLayout>
<ImageView
android:id="#+id/ivFullscreen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="#drawable/iv_add_blue"
android:visibility="gone" />
<ImageView
android:id="#+id/ivMenuOpen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/rel_message"
android:layout_centerVertical="true"
android:layout_marginEnd="#dimen/margin_twenty"
android:layout_marginRight="#dimen/margin_twenty"
android:layout_toLeftOf="#+id/ivFullscreen"
android:layout_toStartOf="#+id/ivFullscreen"
android:src="#drawable/iv_menu_grid"
android:visibility="gone" />
<TextView
android:id="#+id/tv_Title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:text="TITLE"
android:textStyle="bold"
android:visibility="gone" />
<RelativeLayout
android:id="#+id/rel_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toEndOf="#+id/rlAdd"
android:layout_toLeftOf="#+id/iv_send"
android:layout_toRightOf="#+id/rlAdd"
android:layout_toStartOf="#+id/iv_send"
android:background="#drawable/chat_send_message_background"
android:visibility="visible">
<RelativeLayout
android:id="#+id/rl_chat_send_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:orientation="horizontal">
<EditText
android:id="#+id/et_chat"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="#dimen/margin_ten"
android:layout_marginLeft="#dimen/margin_ten"
android:layout_marginRight="#dimen/margin_ten"
android:layout_marginStart="#dimen/margin_ten"
android:background="#null"
android:hint="#string/type_messsage"
android:inputType="textMultiLine"
android:maxLines="4"
android:padding="#dimen/padding_eight"
android:textColorHint="#color/hint_text_color"
android:textSize="#dimen/text_size_fifteen"
tools:text="zxnihxkbdfcdaaa" />
</RelativeLayout>
</RelativeLayout>
<ImageView
android:id="#+id/iv_send"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_margin="#dimen/margin_five"
android:src="#drawable/iv_send_message_light"
android:visibility="invisible" />
<ImageView
android:id="#+id/iv_record"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_margin="#dimen/margin_five"
android:src="#drawable/iv_audio_record"
android:visibility="visible" />
</RelativeLayout>
<FrameLayout
android:id="#+id/frame_layout"
android:layout_width="match_parent"
android:layout_height="250dp"
android:background="#color/white"
android:padding="#dimen/padding_fifteen"
android:visibility="gone" />
</LinearLayout>
</RelativeLayout>
</android.support.design.widget.CoordinatorLayout>
<RelativeLayout
android:id="#+id/rlChatMessageSendView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<LinearLayout
android:id="#+id/llSpectatorZone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginTop="#dimen/margin_ten"
android:background="#color/white"
android:orientation="horizontal"
android:padding="#dimen/padding_ten"
android:visibility="gone">
<TextView
android:id="#+id/tvSpectatorZone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="#string/you_can_only_view_this_zone"
android:textColor="#color/unselected_item_color"
android:textSize="#dimen/text_size_seventeen" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
Please try below link. It may solve your problem.
http://xmodulo.com/hide-show-toolbar-scrolling-android.html
Thanks !
I am using this lib and when I open the menu it makes the shadow like i am using blur in the background. And loading the songs from the memory(in the main thread). The shadow appears some times. . I dont know why it is happening .In the following layout the background is transparent but the following menu is strong color. what can i do to fix this .I made the images in multiple size also ex hdpi , xhdpi etc. what is the mistake i am doing . The shadow appears when I open and close the menu.
the xml code
<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"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="beatbox.Fragment.Songs">
<!-- TODO: Update blank fragment layout -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="110dp">
<com.github.florent37.arclayout.ArcLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:rotation="180"
app:arc_cropDirection="cropInside"
app:arc_height="40dp"
app:theme="#style/Theme.AppCompat.Light">
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#7c2c3940" />
</com.github.florent37.arclayout.ArcLayout>
</RelativeLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:layout_gravity="fill_vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ListView
android:id="#+id/song_listview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="175dp"
android:divider="#null"
android:cacheColorHint="#00000000"
android:fadingEdgeLength="48dp"
android:requiresFadingEdge="vertical"
android:fadingEdge="horizontal"
android:overScrollMode="never" />
</LinearLayout>
</ScrollView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="120dp">
<ImageButton
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_marginRight="21dp"
android:layout_marginEnd="21dp"
android:id="#+id/imageButton"
android:background="#00000000"
android:scaleType="fitXY"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginTop="30dp" />
<TextView
android:id="#+id/textView16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView15"
android:layout_alignStart="#+id/textView15"
android:layout_below="#+id/textView15"
android:maxLines="1"
android:layout_marginEnd="140dp"
android:layout_marginRight="140dp"
android:singleLine="true"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:id="#+id/textView15"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_width="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginEnd="120dp"
android:layout_marginLeft="24dp"
android:layout_marginRight="120dp"
android:layout_marginStart="24dp"
android:layout_marginTop="31dp"
android:maxLines="1"
android:singleLine="true"
android:text="#string/total_songs"
android:textSize="26sp" />
</RelativeLayout>
</RelativeLayout>
<FrameLayout
android:id="#+id/edittextview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="invisible">
<com.github.stephenvinouze.shapeview.shapes.HalfCircleEdgeShapeView
android:layout_width="match_parent"
android:layout_height="66dp"
android:layout_marginLeft="16.5dp"
android:layout_marginRight="16.5dp"
android:layout_marginTop="105dp"
android:elevation="0dp"
app:shapeColor="#color/colorAccent">
<ImageButton
android:id="#+id/close_edittext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerInParent="true"
android:layout_marginLeft="17dp"
android:layout_marginStart="17dp"
android:background="#00000000"
app:srcCompat="#drawable/ic_clear_white_48dp"
/>
<EditText
android:id="#+id/editText"
style="#android:style/Theme.Holo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginEnd="20dp"
android:layout_marginRight="20dp"
android:layout_toEndOf="#+id/close_edittext"
android:layout_toRightOf="#+id/close_edittext"
android:hint="Search"
android:inputType="textPersonName"
android:paddingEnd="20dp"
android:paddingRight="20dp"
android:textSize="18sp"
tools:ignore="HardcodedText" />
</com.github.stephenvinouze.shapeview.shapes.HalfCircleEdgeShapeView>
</FrameLayout>
<FrameLayout
android:id="#+id/menu"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true">
<com.srx.widget.TabBarView
android:id="#+id/tabBarView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="105dp"
android:elevation="0dp" >
</com.srx.widget.TabBarView>
</FrameLayout>
I would like my button to be at the bottom of my layout but it doesn't seem to be working. Somehow it's stuck at the middle of my screen and it won't go down... code below. My main LinearLayout seems to have a match_parent height though...
<ScrimInsetsScrollView
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="#dimen/navdrawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
android:id="#+id/navdrawer"
android:background="#color/navdrawer_background"
android:fitsSystemWindows="true"
app:insetForeground="#4000">
<LinearLayout android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:id="#+id/chosen_account_view"
android:layout_width="match_parent"
android:layout_height="#dimen/navdrawer_chosen_account_height"
android:layout_alignParentTop="true">
<!--android:foreground="?photoItemForeground"-->
<!-->-->
<ImageView android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="#drawable/ic_foodie_nav_image"
android:tint="#color/session_photo_scrim"
android:id="#+id/profile_cover_image"
/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="#dimen/keyline_1"
android:paddingRight="#dimen/keyline_1"
android:paddingTop="#dimen/keyline_1"
android:id="#+id/chosen_account_content_view"
android:onClick="showProfile">
<com.pkmmte.view.CircularImageView
android:id="#+id/profile_image"
android:layout_width="#dimen/navdrawer_profile_image_size"
android:layout_height="#dimen/navdrawer_profile_image_size"
android:src="#drawable/ic_action_person"
android:scaleType="centerCrop"
android:layout_marginTop="16dp"
/>
<ImageView
android:id="#+id/expand_account_box_indicator"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:visibility="gone"
android:layout_marginLeft="16dp"
android:paddingBottom="16dp"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:scaleType="center"
android:src="#drawable/ic_drawer_accounts_expand" />
<TextView
android:id="#+id/profile_email_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="#id/profile_image"
android:layout_toLeftOf="#id/expand_account_box_indicator"
android:layout_alignParentBottom="true"
android:paddingBottom="16dp"
android:textSize="#dimen/text_size_medium"
android:textColor="#color/body_text_2_inverse"
android:maxLines="1"
android:singleLine="true"
android:ellipsize="end"/>
<TextView
android:id="#+id/profile_name_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#id/profile_email_text"
android:layout_alignLeft="#id/profile_image"
android:layout_toLeftOf="#id/expand_account_box_indicator"
android:textSize="#dimen/text_size_large"
android:textColor="#color/body_text_1_inverse"
android:maxLines="1"
android:singleLine="true"
android:ellipsize="end"
android:textStyle="bold"/>
</RelativeLayout>
</FrameLayout>
<FrameLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<!-- Account items -->
<LinearLayout
android:id="#+id/account_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:orientation="vertical"
android:visibility="invisible" />
<LinearLayout
android:id="#+id/navdrawer_items_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:orientation="vertical"
/>
</FrameLayout>
<Button
android:layout_width="wrap_content"
android:layout_height="50dp"
android:background="#color/red_500"
android:layout_gravity="bottom"
android:gravity="bottom"
/>
</LinearLayout>
</ScrimInsetsScrollView>
The solution is in that post LinearLayout not expanding inside a ScrollView
Found the solution myself in the end. The problem was not with the
LinearLayout, but with the ScrollView (seems weird, considering the
fact that the ScrollView was expanding, while the LinearLayout
wasn't).
The solution was to use android:fillViewport="true" on the ScrollView.
Just use it on the Scrimset