Cant get circular progress bar to display when using ScrollView - android

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.

Related

Xamarin Listview doesnt follow the rtl direction

Helly guys.
Im learning xamarin and trying to make a basic food app for android. This app is in RTL direction. Now i have a Listview in my main content which contains a list of custom layouts. Here is a look at this custom layout. I is RTL in Xamarin Designer windows.
And this is the layout axaml code
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layoutDirection="rtl"
android:textDirection="rtl">
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/linearLayout2">
<ImageView
android:src="#drawable/rating4"
android:id="#+id/imgRating"
android:layout_width="70dp"
android:layout_height="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="10dp" />
<ImageView
android:src="#drawable/defaultthumbnail"
android:id="#+id/imgThumbnail"
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp" />
<TextView
android:text="10,000 تومان"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:textStyle="bold"
android:id="#+id/foodPrice"
android:layout_marginLeft="5dp"
android:textDirection="rtl" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp">
<TextView
android:text="نام غذا"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/txtFoodName"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:text="توضیحات غذا"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="12sp"
android:id="#+id/txtFoodDesc" />
<TextView
android:text="تاریخ"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/txtDate"
android:textSize="8sp"
android:textAllCaps="false" />
<TextView
android:text="آشپز"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/txtCook"
android:textSize="8sp"
android:textAllCaps="false" />
</LinearLayout>
And this is my main layout which this listview is in it.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/mainContentLayout"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:showIn="#layout/app_bar_main"
android:layoutDirection="rtl"
android:textDirection="rtl">
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/mainContentListView"
android:layoutDirection="rtl"
android:textDirection="rtl" />
</LinearLayout>
But when i run this this is what i get
as you can those 2 linearlayouts inside are following the rule of RTL but are inverted.
I had the same problem and I fixed it by adding the following in the application's manifest:
<manifest>
<application>
android:supportsRtl="true"
</application>
</manifest>
default emulator and preview didn't work well with "RTL" languages. try to test on real android device or try xamarin live player.
also some android devices force "ltr" when the android interface language is English,try to change android language to a "RTL' language.
About android:supportsRtl="true", you can refer to this, it's default value is false.
From your layout axaml code, it displays in VS's Design as:
But it display in AS's Design as:
It is same as the result what you have run.
So, there is something wrong with VS's Design.
If I didn't misread your question, what you want to get is:
So, you need change your layout axaml code to below:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layoutDirection="rtl"
android:textDirection="rtl">
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/linearLayout2">
<ImageView
android:src="#drawable/pause"
android:id="#+id/imgRating"
android:layout_width="70dp"
android:layout_height="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="10dp" />
<ImageView
android:src="#drawable/dapao"
android:id="#+id/imgThumbnail"
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp" />
<TextView
android:text="10,000 تومان"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:textStyle="bold"
android:id="#+id/foodPrice"
android:layout_marginLeft="5dp"
android:textDirection="rtl" />
</LinearLayout>
<View
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="match_parent"/>
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp">
<TextView
android:text="نام غذا"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/txtFoodName"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:text="توضیحات غذا"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="12sp"
android:id="#+id/txtFoodDesc" />
<TextView
android:text="تاریخ"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/txtDate"
android:textSize="8sp"
android:textAllCaps="false" />
<TextView
android:text="آشپز"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/txtCook"
android:textSize="8sp"
android:textAllCaps="false" />
</LinearLayout>
</LinearLayout>

Layout_height doesn't want to gradually wrap contents when fragment are being used

What i want to accomplish is to create rating section like Google Play Store, i managed to display all the stars and review(for user to comment) but whenever the user type on it, the layout height of the RelativeLayout on my activity doesn't wrap the layout of the fragment within a fragment. I tried changing the height in any means, but still nothing solve the problem. The thing is when i make my TabLayout visible, it follows the height, but not my custom ViewPager.
I do not know whether i did it right or wrong or entirely impossible, please show me the right way. Thank you.
activity_view_item.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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.hybridelements.recyclerview.ViewItem">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/singleImageView"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="29dp"
app:srcCompat="#drawable/android" />
<TextView
android:id="#+id/lblTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/lblTitle"
android:layout_alignBottom="#+id/itemName"
android:textSize="16sp"
android:layout_marginLeft="25dp"
android:textStyle="bold"/>
<TextView
android:id="#+id/itemName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="#string/itemName"
android:textSize="16sp"
android:layout_below="#+id/singleImageView"
android:layout_alignStart="#+id/singleImageView"/>
<TextView
android:id="#+id/lblCategory"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/lblCategory"
android:layout_alignTop="#+id/itemCategory"
android:layout_alignStart="#+id/lblTitle"
android:layout_marginRight="30dp"
android:textSize="16sp"
android:textStyle="bold"/>
<TextView
android:id="#+id/itemCategory"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/itemCategory"
android:textSize="16sp"
android:layout_below="#+id/itemName"
android:layout_alignStart="#+id/singleImageView"
android:layout_marginTop="14dp" />
<TextView
android:id="#+id/lblRating"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="#+id/lblCategory"
android:layout_below="#+id/lblCategory"
android:layout_marginTop="13dp"
android:text="#string/lblRating"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:id="#+id/itemRating"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/lblRating"
android:layout_alignStart="#+id/singleImageView"
android:text="#string/itemRating"
android:textSize="16sp" />
<ImageView
android:id="#+id/imageRating"
android:layout_width="17dp"
android:layout_height="17dp"
android:layout_alignBottom="#+id/itemRating"
android:layout_alignTop="#+id/itemRating"
android:layout_gravity="center"
android:layout_toEndOf="#+id/itemRating"
android:layout_marginLeft="5dp"
app:srcCompat="#drawable/star" />
<TextView
android:id="#+id/lblDesc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="13dp"
android:text="#string/lblDesc"
android:textSize="16sp"
android:textStyle="bold"
android:layout_alignStart="#+id/itemDesc"
android:layout_below="#+id/itemRating"/>
<TextView
android:id="#+id/itemDesc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/lblDesc"
android:layout_centerHorizontal="true"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:layout_marginTop="13dp"
android:text="#string/itemDesc"
android:textSize="16sp" />
<RelativeLayout
android:id="#+id/ratingSection"
android:layout_width="match_parent"
android:layout_height="130dp"
android:layout_marginTop="13dp"
android:layout_below="#+id/itemDesc"
android:background="#color/ratingSection">
<!-- Get section from fragment -->
</RelativeLayout>
<RelativeLayout
android:id="#+id/subTab"
android:layout_width="match_parent"
android:layout_height="511.84dp"
android:layout_marginTop="13dp"
android:layout_below="#+id/ratingSection">
<!-- Get section from fragment -->
</RelativeLayout>
</RelativeLayout>
</ScrollView>
fragment_sub_section_rating.xml
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context="com.hybridelements.openchef.fragment_activities.fragment_subs.SubSectionFragment_ReviewAndInstructions">
<RelativeLayout
android:id="#+id/main_layout"
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"
tools:context=".MainActivity">
<android.support.design.widget.TabLayout
android:id="#+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:elevation="6dp"
android:minHeight="?attr/actionBarSize"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:visibility="gone"/>
<com.hybridelements.openchef.fragment_activities.fragment_subs.CustomSubViewPager
android:id="#+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#id/tab_layout"/>
<com.pixelcan.inkpageindicator.InkPageIndicator
android:id="#+id/fragRating_dotIndicator"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:dotDiameter="8dp"
app:dotGap="8dp"
app:animationDuration="320"
app:pageIndicatorColor="#android:color/darker_gray"
app:currentPageIndicatorColor="#android:color/black"
android:layout_alignBottom="#+id/pager"
android:layout_marginBottom="20dp"
android:visibility="gone" />
</RelativeLayout>
fragment_rating_review.xml
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context="com.hybridelements.openchef.fragment_activities.fragment_subs.RatingFragment_Star">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/ratingReview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/fragmentRating_reviewHeader"
android:textAlignment="center"
android:layout_marginTop="13dp"
android:textSize="16dp"
android:textStyle="bold" />
<RelativeLayout
android:id="#+id/ratingStar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/ratingReview"
android:gravity="center_horizontal">
<EditText
android:id="#+id/userRateReview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"/>
</RelativeLayout>
<Button
android:id="#+id/ratingBtnSubmit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/ratingStar"
android:layout_alignParentEnd="true"
android:text="#string/ratingFrag_BtnSubmit"
style="#style/Widget.AppCompat.Button.Borderless"
android:enabled="false"/>
</RelativeLayout>
The RelativeLayout with id "ratingSection" in ratingSactivity_view_item.xml should follow the height of FrameLayout in fragment_rating_review.xml
This shouldn't happen.
This is before any typing (seems normal)
After typing, the submit button going off the screen
Try with this layout.
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="wrap_content">
<TextView
android:id="#+id/ratingReview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="fragmentRating_reviewHeader"
android:textAlignment="center"
android:layout_marginTop="13dp"
android:textSize="16dp"
android:textStyle="bold" />
<RelativeLayout
android:id="#+id/ratingStar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/ratingStar"
android:layout_below="#+id/ratingReview"
android:gravity="center_horizontal">
<EditText
android:id="#+id/userRateReview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"/>
</RelativeLayout>
<Button
android:id="#+id/ratingBtnSubmit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_alignParentRight="true"
android:layout_below="#+id/ratingStar"
android:text="ratingFrag_BtnSubmit"
style="#style/Widget.AppCompat.Button.Borderless"
android:enabled="false"/>
</LinearLayout>
</FrameLayout>

How to remove the shadow

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>

Remove DrawerLayout top padding that appear in api version > 21

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).

Not able to give scrollbar

How to add scrolling feature to this layout please help
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
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">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbarAlwaysDrawVerticalTrack="true">
<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="wrap_content"
android:layout_weight="0.6"
android:background="#android:color/holo_purple"
android:orientation="horizontal">
<ImageView
android:layout_height="100dp"
android:layout_width="match_parent"
android:scaleType="fitXY"
android:id="#+id/expanded_thumbnail"/>
</LinearLayout>
<RelativeLayout
android:id="#+id/viewB"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.4"
android:background="#android:color/white"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Sangam 2015"
android:textStyle="bold"
android:textSize="15sp"
android:id="#+id/expanded_title"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="33dp"
android:layout_marginStart="33dp"
android:layout_marginTop="31dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="8-10th September 2015"
android:textSize="10dp"
android:textStyle="bold"
android:layout_marginTop="5dp"
android:id="#+id/expanded_date"
android:layout_below="#+id/expanded_title"
android:layout_alignLeft="#+id/expanded_title"
android:layout_alignStart="#+id/expanded_title" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="My name is dushyant suthar"
android:id="#+id/expanded_description"
android:gravity="left"
android:layout_marginTop="12dp"
android:layout_below="#+id/expanded_date"
android:layout_alignLeft="#+id/expanded_date"
android:layout_alignStart="#+id/expanded_date" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
<android.support.design.widget.FloatingActionButton
android:id="#+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:clickable="true"
app:layout_anchor="#id/viewA"
app:layout_anchorGravity="bottom|right|end"/>
When I am using the above code the ImageView is getting small (the height of image is getting decreased) and noting like scrolling in The whole layout.
I dont know about Scroll views I did not understand by googling I want a good link and also solution of above XML and what should I add in Java code
your code seems ok to me but try by removing android.support.design.widget.CoordinatorLayout import or android:scrollbarAlwaysDrawVerticalTrack="true"

Categories

Resources