When I run this on my emulator or real device above android version 7, it works really fine. However,The problem starts when i tried to install it on android version 6 or 5 and below even though my minimum SDK is 4.0.1. or 15.
Last two days tried to solved it by going through different post of stackoverflow, but noting worked properly.
Here is my crash-Stack Tarces log
java.lang.RuntimeException:
at android.app.ActivityThread.performLaunchActivity
(ActivityThread.java:2534)
at android.app.ActivityThread.handleLaunchActivity
(ActivityThread.java:2608)
at android.app.ActivityThread.access$800 (ActivityThread.java:178)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1470)
at android.os.Handler.dispatchMessage (Handler.java:111)
at android.os.Looper.loop (Looper.java:194)
at android.app.ActivityThread.main (ActivityThread.java:5637)
at java.lang.reflect.Method.invoke (Method.java)
at java.lang.reflect.Method.invoke (Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:959)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:754)
Caused by: java.lang.RuntimeException:
at android.app.ActivityManager$TaskDescription.<init>
(ActivityManager.java:555)
at android.app.Activity.onApplyThemeResource (Activity.java:3741)
at android.view.ContextThemeWrapper.initializeTheme
(ContextThemeWrapper.java:140)
at android.view.ContextThemeWrapper.setTheme
(ContextThemeWrapper.java:85)
at android.support.v7.app.AppCompatActivity.setTheme
(AppCompatActivity.java)
at android.app.ActivityThread.performLaunchActivity
(ActivityThread.java:2474)
at android.app.ActivityThread.handleLaunchActivity
(ActivityThread.java:2608)
at android.app.ActivityThread.access$800 (ActivityThread.java:178)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1470)
at android.os.Handler.dispatchMessage (Handler.java:111)
at android.os.Looper.loop (Looper.java:194)
at android.app.ActivityThread.main (ActivityThread.java:5637)
at java.lang.reflect.Method.invoke (Method.java)
at java.lang.reflect.Method.invoke (Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:959)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:754)
android manifests
<?xml version="1.0" encoding="utf-8"?>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:allowBackup="true"
android:icon="#drawable/iconlarge"
android:label="#string/app_name"
android:roundIcon="#drawable/iconlarge"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".dropdown.AboutUs"></activity>
<activity android:name=".Activity.MainActivity">
<intent-filter>
[![enter image description here][1]][1]<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".viewClass" />
/>
<activity android:name=".webview.seetings.PrivacyPolicy" />
<activity android:name=".webview.seetings.TermsCondition" />
<activity android:name=".infozone" />
<activity android:name=".webview.timeadjust" />
</application>
Here is my Style.xml resource:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/transparent</item>
<item name="colorPrimaryDark">#color/black</item>
<item name="colorAccent">#color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay"
parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay"
parent="ThemeOverlay.AppCompat.Light"/>
<style name="TextAppearance.AppCompat.Widget.ActionBar.Title"
parent="#android:style/TextAppearance">
<item name="android:textSize">20sp</item>
<item name="android:textColor">#color/black</item>
</style>
Main Activity Layout
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:gravity="center"
android:padding="1dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/Land1"
android:layout_margin="14dp"
android:text="#string/LandTime"
android:textAllCaps="false"
android:textAlignment="center"
android:textSize="15sp"
android:textStyle="bold"
android:textColor="#color/liteblue"
android:background="#drawable/border"
android:padding="10dp"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/Land2"
android:layout_margin="14dp"
android:text="#string/LandDua"
android:textAllCaps="false"
android:textAlignment="center"
android:textSize="15sp"
android:textStyle="bold"
android:textColor="#color/liteblue"
android:background="#drawable/border"
android:padding="10dp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/Land3"
android:layout_margin="14dp"
android:text="#string/LandOju"
android:textAllCaps="false"
android:textAlignment="center"
android:textSize="15sp"
android:textStyle="bold"
android:textColor="#color/liteblue"
android:background="#drawable/border"
android:padding="10dp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/Land4"
android:layout_margin="14dp"
android:text="#string/LandKoron"
android:textAllCaps="false"
android:textAlignment="center"
android:textSize="15sp"
android:textStyle="bold"
android:textColor="#color/liteblue"
android:background="#drawable/border"
android:padding="10dp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/Land5"
android:layout_margin="14dp"
android:text="#string/LandHadis"
android:textAllCaps="false"
android:textAlignment="center"
android:textSize="15sp"
android:textStyle="bold"
android:textColor="#color/liteblue"
android:background="#drawable/border"
android:padding="10dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:layout_marginBottom="50dp"
android:orientation="horizontal"
android:weightSum="9"
>
<Button
android:id="#+id/share"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="3dp"
android:layout_weight="3"
android:background="#color/coloraqua"
android:drawableLeft="#drawable/share"
android:text="Share"
android:textAllCaps="false"
/>
<Button
android:id="#+id/rate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="3dp"
android:layout_weight="3"
android:background="#color/coloraqua"
android:drawableLeft="#drawable/rating"
android:shadowColor="#color/colorAccent"
android:text="Rate"
android:textAllCaps="false" />
<Button
android:id="#+id/info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="3dp"
android:layout_marginRight="3dp"
android:layout_weight="3"
android:background="#color/coloraqua"
android:drawableLeft="#drawable/infoa"
android:text="Info"
android:textAllCaps="false" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:orientation="horizontal"
android:weightSum="9">
</LinearLayout>
</LinearLayout>
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="#+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-2863417604404784/6151426605">
</com.google.android.gms.ads.AdView>
</RelativeLayout>
</android.support.v7.widget.CardView>
View class for recycler Adapter
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:background="#drawable/border"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="center"
android:layout_margin="5dp"
android:background="#color/white"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ddddddddd"
android:textStyle="bold"
android:textSize="20sp"
android:id="#+id/title"
android:padding="10dp"
android:textColor="#color/black"/>
</LinearLayout>
</RelativeLayout>
viewclass for recycler adapter
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center">
<android.support.v7.widget.RecyclerView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/recycle"
android:layout_gravity="center"
>
</android.support.v7.widget.RecyclerView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="#+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="#string/banner">
</com.google.android.gms.ads.AdView>
</RelativeLayout>
webview layout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingBottom="#dimen/activity_vertical_margin"
tools:context=".Activity.MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="58dp">
<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/webView"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
</LinearLayout>
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="#+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="#string/O3">
</com.google.android.gms.ads.AdView>
</RelativeLayout>
one additional error log
1. java.lang.RuntimeException:
2. at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2534)
3. at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java:2608)
4. at android.app.ActivityThread.access$800 (ActivityThread.java:178)
5. at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1470)
6. at android.os.Handler.dispatchMessage (Handler.java:111)
7. at android.os.Looper.loop (Looper.java:194)
8. at android.app.ActivityThread.main (ActivityThread.java:5637)
9. at java.lang.reflect.Method.invoke (Native Method)
11. at java.lang.reflect.Method.invoke (Method.java:372)
12. at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:959)
13. at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:754)
Caused by: java.lang.RuntimeException:
14. at android.app.ActivityManager$TaskDescription.<init> (ActivityManager.java:555)
15. at android.app.Activity.onApplyThemeResource (Activity.java:3741)
16. at android.view.ContextThemeWrapper.initializeTheme (ContextThemeWrapper.java:140)
17. at android.view.ContextThemeWrapper.setTheme (ContextThemeWrapper.java:85)
18. at a.b.h.a.m.setTheme(:0)
19. at android.app.ActivityThread.performLaunchActivity (ActivityThread.java:2474)
Related
My XML CODE:-
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/white"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp">
<TextView
android:id="#+id/tvCollege"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="NGF\nCOLLEGE"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/tvNameTeacher"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_gravity="center"
android:layout_toLeftOf="#id/imgBarTeachers"
android:layout_toRightOf="#id/tvCollege"
android:gravity="center"
android:textAllCaps="true"
android:textColor="#color/colorAccent"
android:textSize="18sp" />
<ImageView
android:id="#+id/imgBarTeachers"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="#drawable/ic_menu" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingTop="20dp"
android:paddingRight="10dp"
android:paddingBottom="20dp">
<ImageView
android:layout_width="96dp"
android:layout_height="96dp"
android:padding="10dp"
android:src="#drawable/ic_teachers" />
<View
android:layout_width="1dp"
android:layout_height="76dp"
android:layout_gravity="center_vertical"
android:layout_marginLeft="9dp"
android:layout_marginRight="9dp"
android:background="#android:color/black" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical">
<TextView
android:id="#+id/tvSubjectTeacher"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAllCaps="true"
android:textColor="#414141"
android:textSize="18sp" />
<TextView
android:id="#+id/tvMobileTeacher"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="18sp" />
<TextView
android:id="#+id/tvMailTeacher"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="18sp" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#android:color/black" />
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/recyclerViewMenuTeacher"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none" />
</LinearLayout>
My app is running perfectly but when I'm running my app in android 7.0 it's showing me this error.
Error what I'm getting:
Process: com.ngfcet.ngfconnection, PID: 21684
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ngfcet.ngfconnection/com.ngfcet.ngfconnection.activities.TeacherActivity}: android.view.InflateException: Binary XML file line #21: Binary XML file line #21: Error inflating class TextView
I think this error is also can formed by firebase because
which textview have +id/tvCollege is not showing any error because I'm not putting any data in it through firebase
Theme for whole application
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowLightStatusBar" tools:targetApi="m">true</item>
<item name="android:statusBarColor" tools:targetApi="lollipop">#android:color/white</item>
<item name="android:windowLightNavigationBar" tools:targetApi="o_mr1">true</item>
<item name="android:navigationBarColor" tools:targetApi="lollipop">#android:color/white</item>d
<item name="android:fontFamily">sans-serif-medium</item>
</style>
</resources>
It's too simple. I have removed
<item name="android:fontFamily">sans-serif-medium</item>
from styles.xml
Thanks! It's working perfect now
I know this question has been on the internet for ages, but nothing seems to work in my case.
What's wrong
As seen in screenshots, the layout having the spinner is not pushed up and is overlapped by the soft keyboard. I want this layout to be placed just above the keyboard when it pops up.
My layout file
<?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:background="#android:color/white"
android:orientation="vertical"
tools:context="believe.cht.speak.MainActivity">
<ImageView
android:id="#+id/logo"
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_gravity="center_horizontal"
android:layout_margin="16dp"
android:src="#drawable/ic_bubble"
android:tint="#color/blue" />
<EditText
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#android:color/transparent"
android:gravity="top|start"
android:hint="Start typing..."
android:padding="8dp" />
<ImageView
android:id="#+id/shadow"
android:layout_width="match_parent"
android:layout_height="6dp"
android:src="#drawable/shadow" />
<RelativeLayout
android:id="#+id/spinnerLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="#color/blue">
<Spinner
android:id="#+id/spinner"
android:layout_width="200dp"
android:layout_height="48dp"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</LinearLayout>
What I've tried
android:windowSoftInputMode="adjustResize"
android:windowSoftInputMode="adjustPan" //in the manifest, also tried combining the two
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); //in the activity
<item name="android:windowActionBarOverlay">true</item> //in styles.xml
Try this
<?xml version="1.0" encoding="utf-8"?>
<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:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#android:color/white"
android:orientation="vertical">
<ImageView
android:id="#+id/logo"
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_gravity="center_horizontal"
android:layout_margin="16dp"
android:src="#drawable/ic_message" />
<EditText
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#android:color/transparent"
android:gravity="top|start"
android:hint="Start typing..."
android:padding="8dp" />
<ImageView
android:id="#+id/shadow"
android:layout_width="match_parent"
android:layout_height="6dp"
android:src="#drawable/ic_camera" />
<RelativeLayout
android:id="#+id/spinnerLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="#color/colorPrimary">
<Spinner
android:id="#+id/spinner"
android:layout_width="200dp"
android:layout_height="48dp"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
Manifest file
<activity android:name=".MyActivity"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
OUTPUT
Adding to Nilesh's answer above, even though the code worked, it didn't work with my Java class. The reason was that I was hiding the statusbar with
requestWindowFeature(Window.FEATURE_NO_TITLE);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
Using the code provided and leaving the statusbar untouched did the job. Don't know why. I would be helpful if anyone could explain this.
Try using a RelativeLayout instead of LinearLayout and add android:alignParentBottom="true" to your spinnerLayout
screen isn't scrolling up when the keyboard appers. I've read many answers saying to use android:windowSoftInputMode="something" I tried many of them
android:windowSoftInputMode="adjustPan|adjustResize"
android:windowSoftInputMode="adjustResize"
android:windowSoftInputMode="adjustPan"
android:windowSoftInputMode="stateVisible|adjustResize"
android:windowSoftInputMode="stateVisible"
(also tried some others) none of them worked
I think the problem is on my xml which the most was generated by android studio "activity login" template.
is there any other way to do it?
my xml file
<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:gravity="center_horizontal"
android:orientation="vertical"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context="com.example.eduardo.academia.LoginActivity">
<!-- Login progress -->
<ProgressBar
android:id="#+id/login_progress"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:visibility="gone" />
<ImageView
android:id="#+id/imageView"
android:layout_width="211dp"
android:layout_height="235dp"
app:srcCompat="#drawable/logo"
android:windowSoftInputMode="stateHidden"/>
<LinearLayout
android:id="#+id/login_form"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/email_login_form"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<AutoCompleteTextView
android:id="#+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/prompt_email"
android:inputType="textEmailAddress"
android:maxLines="1"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/prompt_password"
android:imeActionId="#+id/login"
android:imeActionLabel="#string/action_sign_in_short"
android:imeOptions="actionUnspecified"
android:inputType="textPassword"
android:maxLines="1"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<Button
android:id="#+id/email_sign_in_button"
style="?android:textAppearanceSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="#string/action_sign_in"
android:textStyle="bold" />
<TextView
android:id="#+id/txtMudarSenha"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:gravity="center"
android:text="#string/forgot_password"
android:onClick="mudarSenha"
android:clickable="true"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
android manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.eduardo.academia">
<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:windowSoftInputMode="stateVisible|adjustResize"
android:name=".LoginActivity"
android:label="#string/title_activity_login"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ExerciciosActivity"
android:label="#string/title_activity_exercicios"
android:theme="#style/AppTheme.NoActionBar"></activity>
</application>
</manifest>
You should use a ScrollView for this. try below xml for your layout
<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:fillViewport="true">
<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:gravity="center_horizontal"
android:orientation="vertical"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context="com.example.eduardo.academia.LoginActivity">
<!-- Login progress -->
<ProgressBar
android:id="#+id/login_progress"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:visibility="gone" />
<ImageView
android:id="#+id/imageView"
android:layout_width="211dp"
android:layout_height="235dp"
app:srcCompat="#drawable/logo"
android:windowSoftInputMode="stateHidden"/>
<LinearLayout
android:id="#+id/login_form"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/email_login_form"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<AutoCompleteTextView
android:id="#+id/email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/prompt_email"
android:inputType="textEmailAddress"
android:maxLines="1"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="#+id/password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/prompt_password"
android:imeActionId="#+id/login"
android:imeActionLabel="#string/action_sign_in_short"
android:imeOptions="actionUnspecified"
android:inputType="textPassword"
android:maxLines="1"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
<Button
android:id="#+id/email_sign_in_button"
style="?android:textAppearanceSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:text="#string/action_sign_in"
android:textStyle="bold" />
<TextView
android:id="#+id/txtMudarSenha"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40dp"
android:gravity="center"
android:text="#string/forgot_password"
android:onClick="mudarSenha"
android:clickable="true"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
I have an app where I have set the top bar / status bar to ascent colors, its working for most screens on lollipop but having an issue on one of the screen its an activity. The code is as follows:
<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"
tools:context="com.realsales.reatsalesapp.activities.EditContactActivity">
<android.support.v7.widget.Toolbar
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/toolbarEC"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/scrollView"
android:layout_gravity="center_horizontal"
android:layout_below="#+id/toolbarEC">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/toolbarEC">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:gravity="center|center_vertical"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:id="#+id/linearLayout6"
android:layout_marginTop="20dp">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:id="#+id/imageView9"
android:src="#drawable/ic_person_black_48dp" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/editTextTitleEC"
android:layout_marginRight="20dp"
android:layout_marginLeft="20dp"
android:hint="title"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_centerHorizontal="true"
android:id="#+id/linearLayout18"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:id="#+id/imageView10"
android:src="#drawable/ic_local_hotel_black_48dp"
android:layout_marginLeft="20dp" />
<EditText
android:layout_width="60dp"
android:layout_height="wrap_content"
android:id="#+id/editText6"
android:layout_marginLeft="10dp"
android:textSize="16sp"
android:hint="bed" />
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:id="#+id/imageView10"
android:src="#drawable/shower1"
android:layout_marginLeft="10dp" />
<EditText
android:layout_width="60dp"
android:layout_height="wrap_content"
android:id="#+id/editText6"
android:layout_marginLeft="10dp"
android:textSize="16sp"
android:hint="bath" />
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:id="#+id/imageView10"
android:src="#drawable/ic_directions_car_black_48dp"
android:layout_marginLeft="10dp" />
<EditText
android:layout_width="60dp"
android:layout_height="wrap_content"
android:id="#+id/editText6"
android:layout_marginLeft="10dp"
android:textSize="16sp"
android:hint="car" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
And when I launch it, it looks as follows:
For most of the other activities it's working fine.
I am not getting what's causing this.
My colors.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="primary_500">#FF9800</color>
<!--Indigo 700-->
<color name="primary_700">#F57C00</color>
<!--Pink 500-->
<color name="accent_500">#2196F3</color>
<!--Pink 700-->
<color name="accent_700">#1976D2</color>
<color name="black_trans80">#33000000</color>
<color name="tab_scroll_color">#ffffff</color>
</resources>
And style.xml:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/primary_500</item>
<item name="colorPrimaryDark">#color/primary_700</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:fitsSystemWindows">true</item>
<item name="android:windowActionBarOverlay">true</item>
</style>
</resources>
Additional information
This activity is loaded after another activity which also has same issue I think that might be a cause, basically it has CollapsingToolBar in it. It's code is as follows:
<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="match_parent"
android:id="#+id/frameLayoutVG"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:id="#+id/appbar"
android:layout_width="match_parent"
android:layout_height="200dp"
android:fitsSystemWindows="true"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.design.widget.CollapsingToolbarLayout
android:id="#+id/view_group_collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginEnd="64dp"
app:expandedTitleMarginStart="48dp"
app:layout_scrollFlags="enterAlwaysCollapsed">
<ImageView
android:id="#+id/view_group_imageViewGroupHeader"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/header"
android:fitsSystemWindows="true"
android:scaleType="centerCrop"
app:layout_collapseMode="pin" />
<android.support.v7.widget.Toolbar
android:id="#+id/view_group_anim_toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
</FrameLayout>
Added manifest as well on request:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.realsales.reatsalesapp" >
<uses-feature
android:name="android.hardware.camera"
android:required="true" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".activities.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".activities.AddLocationActivity"
android:label="#string/title_activity_add_location" >
</activity>
<activity
android:name=".activities.ViewGroupActivity"
android:label="#string/title_activity_view_group" >
</activity>
<activity
android:name=".activities.EditContactActivity"
android:label="#string/title_activity_edit_contact" >
</activity>
</application>
</manifest>
in Your styles.xml or themes.xml
check android:statusBarColor change it to black color(as you want to remove gray color, and have normal look)
<item name="colorPrimary">#color/yourColor</item>
<item name="colorPrimaryDark">#color/yourColor</item>
and remove these below lines of code from styles.xml
<item name="android:windowTranslucentStatus">true</item>
<item name="android:fitsSystemWindows">true</item>
Take a look at your colors.xml, one of these should have the grey color.
colorPrimaryDark
android:statusBarColor
Late answer, but I want to share this simple solution to this problem.
Just add this line in your <style></style> tag in styles.xml:
<item name="android:statusBarColor">#android:color/transparent</item>
I'm trying to create a chronometer, but I have a problem with the code. When I open the app on my tablet and on the emulator the app does not work, but this launches with no problem.
Please help me :(, or if you have another chronometer script available with milliseconds, please share it, as I haven't found anything else that would do what I need.
The error:
06-06 16:59:43.048 3724-3724/com.colorchronometer.rubiks E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.colorchronometer.rubiks/com.colorchronometer.rubiks.StopwatchActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
at android.app.ActivityThread.access$600(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
The manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.colorchronometer.rubiks" >
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".StopwatchActivity"
android:label="#string/app_name"
android:theme="#android:style/Theme.Black.NoTitleBar"
android:configChanges="keyboardHidden|orientation"/>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</application>
</manifest>
And the xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/parentFrameLayout">
<ImageView
android:src="#drawable/bkgl"
android:scaleType="fitXY"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/backgroundImageView">
</ImageView>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/linearLayout">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="horizontal"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:id="#+id/timerBackground"
android:background="#drawable/timerbackground.9">
<TextView
style="#style/timerText"
android:text="#string/timer"
android:id="#+id/timer">
</TextView>
<TextView
style="#style/timerText"
android:text="#string/timerMs"
android:id="#+id/timerMs"
android:textSize="30sp"
android:paddingTop="30sp">
</TextView>
</LinearLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:id="#+id/scrollView">
</ScrollView>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_gravity="center_horizontal"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="20dp"
android:id="#+id/buttonArea"
android:layout_weight="1">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ButtonstartButton- android-onClick=-startClick-
style="#style/buttonText"
android:layout_marginLeft="5dp"
android:background="#ff5cff9b"
android:textColor="#5F3A00"
android:shadowColor="#FBEBC5"
android:text="#string/startText"
android:layout_weight="0.5">
</Button>
<Button
style="#style/buttonText"
android:background="#FFFF6E75"
android:textColor="#2E2E2E"
android:shadowColor="#959597"
android:text="#string/resetText"
android:id="#+id/resetButton"
android:onClick="resetClick"
android:layout_weight="0.5">
</Button>
<Button
style="#style/buttonText"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="#ffff6e75"
android:textColor="#7A1100"
android:shadowColor="#DF726E"
android:text="#string/stopText"
android:id="#+id/stopButton"
android:visibility="gone"
android:onClick="stopClick"
android:layout_weight="1">
</Button>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</FrameLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true" >
</RelativeLayout>