Right Drawer Layout out of margin - android

I'm using DrawerLayout in my app.
I test it in Samsung note 3 and samsung S4 everything is fine. But when it test to Samsung S3 the layout has messed up.
Please refer to below image
Test in Samsung Note 3 and Samsung S4 :
http://www.imagesup.net/?di=1514046988962
Test in Samsung S3 :
http://www.imagesup.net/?di=14140469921515
My xml layout code as following below :
<include
android:id="#+id/shopping_cart_slider"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="end"
layout="#layout/shopping_cart_redesign"
android:choiceMode="singleChoice" />
And this is layout that included :
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/grey_register_text" >
<LinearLayout
android:id="#+id/shopping_cart_redesign_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/grey_register_text"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<RelativeLayout
android:id="#+id/info_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/white"
android:orientation="vertical" >
<ImageView
android:id="#+id/logo_image"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:contentDescription="#string/desc_list_item_icon" />
<com.zukami.apps.dev.blynk.util.CustomListView
android:id="#+id/list_shopping_cart"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/logo_image"
android:background="#android:color/white"
android:divider="#color/grey_register_text"
android:dividerHeight="1dp" >
</com.zukami.apps.dev.blynk.util.CustomListView>
<View
android:id="#+id/border"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/list_shopping_cart"
android:layout_marginTop="5dp"
android:background="#color/grey_register_text" />
<RelativeLayout
android:id="#+id/total_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/border"
android:layout_marginTop="10dp" >
<LinearLayout
android:id="#+id/total_text_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="2dp"
android:orientation="vertical" >
<TextView
android:id="#+id/total_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="#string/total"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="#+id/merchandise_total"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="#string/merchandise_total"
android:textSize="15sp" />
<TextView
android:id="#+id/loyalty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="#string/loyalty"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:orientation="vertical" >
<TextView
android:id="#+id/total_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="#+id/total_points"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:textSize="15sp" />
</LinearLayout>
</RelativeLayout>
<View
android:id="#+id/border_two"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="#+id/total_layout"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="5dp"
android:background="#android:color/black" />
<Button
android:id="#+id/confirm_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/border_two"
android:layout_marginBottom="2dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="10dp"
android:background="#drawable/grey_shopping_cart_button"
android:gravity="center|center_horizontal"
android:text="#string/confirm_order"
android:textColor="#android:color/white"
android:textSize="16sp"
android:textStyle="bold" />
<View
android:id="#+id/space"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_below="#+id/confirm_button"
android:layout_marginTop="5dp" />
</RelativeLayout>
<ImageView
android:id="#+id/receipt_border"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/info_container"
android:layout_marginTop="-6dp"
android:contentDescription="#string/icon"
android:src="#drawable/receipt_border" />
<TextView
android:id="#+id/receipt_footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/receipt_border"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textColor="#android:color/white"
android:textSize="15sp" />
<ProgressBar
android:id="#+id/progressBar1"
style="?android:attr/progressBarStyleLargeInverse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:visibility="gone" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
Kindly advise what's wrong with this layout because I have set all width to match parent but still not working in all device.
Really appreciate for any kind help.

Hmm, I cant see anything wrong right now.
One time I had a problem that anything on my code was wrong, but on devices running API 18+ the android:gravity="center_vertical" simple did not work, but I fix it just changing the value of android:target="18" to android:target="16". I choose "16" because it was the version of my Android that was running without any problems.
I don't know if this is your case, but change the android target property at Android Manifest.xml, just give it a try (y)

Related

Cant get circular progress bar to display when using ScrollView

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.

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>

How to avoid the frame layout is pushed up when the soft keyboard appears?

I am facing the issue ,when the soft keyboard is appeared the frame layout in top of the activity is pushed up .The Frame Layout is placed inside the Linear Layout and below the scrollview is placed inside the scrollview multiple edittext are placed . I have tried the answers posted in the stack overflow but still my problem is not solved.
I am buliding the app in target sdk version 25 and mimimum version 16.
I applied `below method to the activity in AndroidManifestFile.
<activity android:name=".Activities.ScamLookUpActivity"
android:configChanges="keyboard|keyboardHidden|screenSize|screenLayout|"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize"/>`
I don't know how to solve this error and tell the reason the why the given method is not appllied to my activity.
This is my xml layout file...
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/activity_scam_look_up"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#eee"
tools:context="com.zcodia.scamlookup.Activities.ScamLookUpActivity">
<FrameLayout
android:id="#+id/frameLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<View
android:layout_width="match_parent"
android:layout_marginTop="20dp"
android:layout_height="?android:attr/actionBarSize"
android:background="#mipmap/bg_splash_cut">
</View>
<View
android:layout_width="match_parent"
android:layout_height="25dp"
android:alpha="1"
android:background="#A82A37" />
<TextView
android:id="#+id/left_buton"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginLeft="12dp"
android:layout_marginTop="30dp"
android:text="#string/menu"
android:textSize="30dp"
android:gravity="center"
android:textColor="#FFF"/>
<com.zcodia.scamlookup.Utils.CustomTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Scam lookup"
android:layout_marginTop="29dp"
android:layout_marginLeft="60dp"
android:textSize="20dp"
android:textColor="#FFF"
android:gravity="center"/>
</FrameLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#f9f9f9"
android:focusableInTouchMode="true"
android:paddingBottom="20dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="10dp"
android:background="#drawable/text_input2"
>
<com.zcodia.scamlookup.Utils.CustomTextView
android:text="Search Scam Database"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:id="#+id/textView4"
android:textSize="20dp"
android:textColor="#000"
android:layout_below="#+id/linearLayout"
android:typeface="sans"
/>
<com.zcodia.scamlookup.Utils.CustomTextView
android:text="Contact Medium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/textView4"
android:layout_marginLeft="10dp"
android:id="#+id/details_id"
android:textColor="#D32F2F"
android:typeface="sans"
android:textSize="15dp"
android:layout_marginTop="10dp"/>
<android.support.v7.widget.RecyclerView
android:layout_width="wrap_content"
android:layout_height="60dp"
android:id="#+id/recyclerView"
></android.support.v7.widget.RecyclerView>
</LinearLayout>
<com.zcodia.scamlookup.Utils.CustomTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Category"
android:id="#+id/textView5"
android:layout_below="#+id/linearLayout2"
android:layout_marginTop="10dp"
android:layout_marginLeft="15dp"
android:textColor="#D32F2F"
android:textSize="15dp"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:orientation="vertical"
android:paddingBottom="20dp"
android:id="#+id/relative_spinner"
android:focusableInTouchMode="true">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="#drawable/textinput"
android:layout_marginRight="10dp">
<Spinner
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentTop="true"
android:id="#+id/categorySpinner"
android:text="#string/inheritance"
android:prompt="#string/inheritance"
android:paddingLeft="0dp"
/>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:background="#drawable/textinput"
android:layout_marginRight="10dp">
<Spinner
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="1dp"
android:id="#+id/categorySpinner2"
android:text="#string/inheritance"
android:prompt="#string/inheritance"
android:paddingLeft="0dp"
/>
</RelativeLayout>
<com.zcodia.scamlookup.Utils.CustomEditText
android:inputType="phone"
android:id="#+id/phoneNumber_editText"
android:hint="#string/phonenumber"
android:typeface="sans"
style="#style/CustomFontStyle"
android:layout_marginTop="20dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp">
<AutoCompleteTextView
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="10dp"
android:layout_marginTop="0dp"
android:id="#+id/yourLocation"
android:hint="Location"
android:textColorHint="#757575"
style="#style/CustomFontStyle"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="330dp"
android:text=""
android:id="#+id/scammer_location_font"
android:textColor="#3eb3a0"
android:textSize="25dp"
android:layout_marginTop="10dp"/>
</RelativeLayout>
<com.zcodia.scamlookup.Utils.CustomEditText
android:inputType="textPersonName"
android:hint="#string/scammer_location"
android:id="#+id/scammerLocation_editText"
android:typeface="sans"
style="#style/CustomFontStyle"
android:layout_marginTop="20dp"
/>
<com.zcodia.scamlookup.Utils.CustomEditText
android:inputType="textPersonName"
android:hint="#string/keyWord"
android:id="#+id/keyword_edittext"
android:background="#drawable/textinput"
android:typeface="sans"
style="#style/CustomFontStyle"
android:layout_marginTop="20dp"
/>
</LinearLayout>
<com.wefika.flowlayout.FlowLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/clip_flow_layout"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp">
</com.wefika.flowlayout.FlowLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
>
<com.zcodia.scamlookup.Utils.CustomButton
android:text="Search"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/search_id"
android:background="#mipmap/bg_splash_cut"
android:textColor="#FFFFFF"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"/>
</LinearLayout>
</ScrollView>
The below image is my activity.
when the edittext is pressed the top frame layout is pushed up.
I think you should try "statehidden" and "adjustPan" together.
<activity android:windowSoftInputMode="adjustPan|stateHidden">
Try this answer,
<activity android:windowSoftInputMode="adjustPan"> </activity>
apply this attribute to your Scroll view:android:fitsSystemWindows="true" and Follow this
link

Android app not showing complete Samsung S3 mini

I'm new to android and working on my first app which is from a online course project. The fact is that on Android Studio the app is working fine, but I built the apk file to test it on my phone (Samsung galaxy s3 mini). On device, the app is not showing complete as it is missing an edit text and a button at the bottom of the layout. I'm attaching two screenshots, the first one of the app running on the emulator, and the one running on my smartphone.
App running in the emulator:
App running on the smartphone:
Layout code:
<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:paddingBottom="10dp"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context="com.linfosoft.hangdroid.GameActivity"
tools:showIn="#layout/activity_game">
<ImageView
android:layout_width="wrap_content"
android:layout_height="350dp"
android:id="#+id/imageView"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:src="#drawable/hangdroid_0"
android:layout_marginTop="20dp" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:background="#drawable/gradient_background"
android:layout_below="#+id/imageView"
android:layout_centerHorizontal="true"
android:id="#+id/layoutAddLetter"
android:layout_marginTop="90dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Ingresa letra"
android:id="#+id/textView2"
android:layout_gravity="center_vertical"
android:layout_marginLeft="40dp" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/editText"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:maxLength="1" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Revisar"
android:id="#+id/button2"
android:onClick="introduceLetter" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageView"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="false"
android:layout_alignParentTop="false"
android:layout_marginTop="20dp"
android:id="#+id/layoutLetters">
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="#+id/textView7"
android:layout_marginTop="150dp"
android:layout_marginLeft="20dp"
android:textColor="#color/red" />
</RelativeLayout>
put your xml code within of a ScrolView:
<ScrollView
android:layout_height="match_parent"
android:fillViewport="true"
android:layout_width="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android" >
your xml
</ScrollView>
or add weight at your layouts:
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
</LinearLayout>
Your Hangman picture is really height as it has a value of 350dp
Please check this code:
<ScrollView 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:paddingBottom="10dp"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context="com.linfosoft.hangdroid.GameActivity"
tools:showIn="#layout/activity_game">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="wrap_content"
android:layout_height="350dp"
android:id="#+id/imageView"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:src="#drawable/hangdroid_0"
android:layout_marginTop="20dp" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:background="#drawable/gradient_background"
android:layout_below="#+id/imageView"
android:layout_centerHorizontal="true"
android:id="#+id/layoutAddLetter"
android:layout_marginTop="90dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Ingresa letra"
android:id="#+id/textView2"
android:layout_gravity="center_vertical"
android:layout_marginLeft="40dp" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/editText"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:maxLength="1" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Revisar"
android:id="#+id/button2"
android:onClick="introduceLetter" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/imageView"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="false"
android:layout_alignParentTop="false"
android:layout_marginTop="20dp"
android:id="#+id/layoutLetters">
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="#+id/textView7"
android:layout_marginTop="150dp"
android:layout_marginLeft="20dp"
android:textColor="#color/red" />
</RelativeLayout>
<ScrollView>
As you see I used ScrollView, but scrolling a view would be enabled ONLY if a device would not have enough space to take everything on its screen.
In the other case it would be like any other static layout.
It doesn't mean that you would scroll it on every device or your game would be less attractive ;-)
Also you can change height of your picture to wrap_content, bu I suppose that author if this tutorial make this height by value, because the picture in the reality is much bigger than that with height of 350dp.

Italic font changes TextView layout in Galaxy S5

I have a very strange behavior of TextView layout which only happens in Galaxy S5.
The problem is that when I set the text style to italic, the TextView that aligned with the screen right side seems to get out form the screen (the TextView has a rectangle border).
This strange problem appears only in Galaxy S5! in all other devices that I tried my application and even on other Samsung like S3 and S4 everything looks just fine!
Can anyone explain this behavior and maybe can offer some solutions to this ?
I do have screenshots but I still can't publish images here.
Please refer to layout xml as is! I just comment the textStyle="italic" and then everything looks great!
Only on S5 guys..
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/Black" >
<LinearLayout
android:id="#+id/timerLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:orientation="horizontal" >
<RelativeLayout
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#drawable/nicetextframe" >
<ImageView
android:id="#+id/imRecording"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="#drawable/ic_recording"
android:visibility="gone" />
</RelativeLayout>
<TextView
android:id="#+id/tvTimer"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_above="#+id/gpsDataTable"
android:layout_weight="5"
android:background="#drawable/nicetextframe"
android:gravity="center"
android:text="00:00"
android:textColor="#color/YellowGreen"
android:textSize="35sp"
android:textStyle="italic" />
Ï
</LinearLayout>
<LinearLayout
android:id="#+id/guegesLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="#+id/timerLayout"
android:orientation="horizontal" >
<TextView
android:id="#+id/tvSpeed"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_above="#+id/gpsDataTable"
android:layout_weight="1"
android:background="#drawable/nicetextframe"
android:gravity="center"
android:text="0.0"
android:textColor="#color/YellowGreen"
android:textSize="40sp"
android:textStyle="italic"/>
<TextView
android:id="#+id/tvDistance"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_above="#+id/gpsDataTable"
android:layout_weight="1"
android:background="#drawable/nicetextframe"
android:gravity="center"
android:text="0.0"
android:textColor="#color/YellowGreen"
android:textSize="40sp"
android:textStyle="italic" />
</LinearLayout>
<LinearLayout
android:id="#+id/mapLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/tableRow1"
android:layout_below="#+id/guegesLayout"
android:background="#drawable/nicesqureframe"
android:orientation="horizontal" >
<fragment
android:id="#+id/map"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_marginBottom="20dp"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:layout_marginTop="20dp"
class="com.google.android.gms.maps.MapFragment" />
</LinearLayout>
<TableRow
android:id="#+id/tableRow1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#drawable/black_gradient" >
<ToggleButton
android:id="#+id/btStartStop"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#drawable/button_selector"
android:textColor="#color/DarkGreen"
android:textOff="#string/NewTrip"
android:textOn="#string/StopTrip"
android:textStyle="bold" />
<Button
android:id="#+id/btClose"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#drawable/button_selector"
android:text="#string/Close"
android:textColor="#color/DarkGreen"
android:textStyle="bold" />
</TableRow>
</RelativeLayout>

Categories

Resources