配备Android L的Nexus 5的Material Design

配备Android L的Nexus 5的Material Design,第1张

概述我的应用在AndroidL上崩溃,但在androidkitkat上可以运行.布局上也没有RippleDrawable.这是异常和布局;Xml布局:<RelativeLayoutxmlns:android="http://schemas.android.com/apkes/android"android:orientation="vertical"android:layout_width="match_parent&

我的应用在Android L上崩溃,但在androID kitkat上可以运行.布局上也没有rippledrawable.这是异常和布局;

Xml布局:

<relativeLayout xmlns:androID="http://schemas.androID.com/apk/res/androID"    androID:orIEntation="vertical"    androID:layout_wIDth="match_parent"    androID:layout_height="match_parent"    androID:background="@color/page_background">    <EditText        androID:layout_wIDth="match_parent"        androID:layout_height="wrap_content"        androID:layout_marginleft="30dp"        androID:layout_marginRight="30dp"        androID:inputType="textEmailAddress"        androID:ems="10"        androID:ID="@+ID/usernameET"        androID:layout_alignParenttop="true"        androID:layout_centerHorizontal="true"        androID:layout_margintop="100dp"        androID:hint="@string/username_hint" />    <EditText        androID:layout_wIDth="match_parent"        androID:layout_height="wrap_content"        androID:layout_marginleft="30dp"        androID:layout_marginRight="30dp"        androID:inputType="textPassword"        androID:ems="10"        androID:ID="@+ID/passwordET"        androID:layout_below="@+ID/usernameET"        androID:layout_centerHorizontal="true"        androID:layout_margintop="20dp"        androID:hint="@string/password_hint" />    <button        androID:layout_wIDth="match_parent"        androID:layout_height="wrap_content"        androID:layout_marginleft="60dp"        androID:layout_marginRight="60dp"        androID:text="@string/login_text"        androID:ID="@+ID/loginBtn"        androID:background="@drawable/positive_button_selector"        androID:textcolor="#fff"        androID:layout_below="@+ID/passwordET"        androID:layout_centerHorizontal="true"        androID:layout_margintop="40dp" />    <TextVIEw        androID:layout_wIDth="wrap_content"        androID:layout_height="wrap_content"        androID:text="@string/register_text"        androID:ID="@+ID/registerText"        androID:layout_below="@+ID/loginBtn"        androID:layout_marginleft="50dp"        androID:layout_margintop="40dp"        androID:textcolor="@color/accent_color"        androID:textSize="16sp" />    <TextVIEw        androID:layout_wIDth="wrap_content"        androID:layout_height="wrap_content"        androID:text="@string/forget_password"        androID:ID="@+ID/forgetText"        androID:layout_below="@+ID/registerText"        androID:layout_marginleft="50dp"        androID:layout_margintop="20dp"        androID:textcolor="@color/accent_color"        androID:textSize="16sp" /></relativeLayout>

可绘制的xml’positive_button_selector’:

<selector xmlns:androID="http://schemas.androID.com/apk/res/androID">    <item androID:state_pressed="false">        <shape xmlns:androID="http://schemas.androID.com/apk/res/androID" androID:shape="rectangle">            <solID androID:color="@color/accent_color" />            <corners androID:radius="4dp" />        </shape>    </item>    <item androID:state_pressed="true">        <shape xmlns:androID="http://schemas.androID.com/apk/res/androID" androID:shape="rectangle">            <solID androID:color="@color/teal_light" />            <corners androID:radius="4dp" />        </shape>    </item></selector>

例外情况:

> java.lang.NullPointerException: Attempt to invoke virtual method 'int androID.content.res.colorStateList.getcolorForState(int[], int)' on a null object reference            at androID.graphics.drawable.rippledrawable.activateHotspot(rippledrawable.java:413)            at androID.graphics.drawable.rippledrawable.setActive(rippledrawable.java:229)            at androID.graphics.drawable.rippledrawable.onStateChange(rippledrawable.java:207)            at androID.graphics.drawable.Drawable.setState(Drawable.java:566)            at androID.vIEw.VIEw.drawableStateChanged(VIEw.java:15576)            at androID.Widget.TextVIEw.drawableStateChanged(TextVIEw.java:3477)            at androID.vIEw.VIEw.refreshDrawableState(VIEw.java:15594)            at androID.vIEw.VIEw.handleFocusGainInternal(VIEw.java:4779)            at androID.vIEw.VIEw.requestFocusNoSearch(VIEw.java:7335)            at androID.vIEw.VIEw.requestFocus(VIEw.java:7314)            at androID.vIEw.VIEwGroup.onRequestFocusInDescendants(VIEwGroup.java:2492)            at androID.vIEw.VIEwGroup.requestFocus(VIEwGroup.java:2448)            at androID.vIEw.VIEwGroup.onRequestFocusInDescendants(VIEwGroup.java:2492)            at androID.vIEw.VIEwGroup.requestFocus(VIEwGroup.java:2448)            at androID.vIEw.VIEwGroup.onRequestFocusInDescendants(VIEwGroup.java:2492)            at androID.vIEw.VIEwGroup.requestFocus(VIEwGroup.java:2448)            at androID.vIEw.VIEwGroup.onRequestFocusInDescendants(VIEwGroup.java:2492)            at androID.vIEw.VIEwGroup.requestFocus(VIEwGroup.java:2448)            at androID.vIEw.VIEwGroup.onRequestFocusInDescendants(VIEwGroup.java:2492)            at androID.vIEw.VIEwGroup.requestFocus(VIEwGroup.java:2448)            at androID.vIEw.VIEwGroup.onRequestFocusInDescendants(VIEwGroup.java:2492)            at androID.vIEw.VIEwGroup.requestFocus(VIEwGroup.java:2448)            at androID.vIEw.VIEwGroup.onRequestFocusInDescendants(VIEwGroup.java:2492)            at androID.vIEw.VIEwGroup.requestFocus(VIEwGroup.java:2448)            at androID.vIEw.VIEwGroup.onRequestFocusInDescendants(VIEwGroup.java:2492)            at androID.vIEw.VIEwGroup.requestFocus(VIEwGroup.java:2448)            at androID.vIEw.VIEwGroup.onRequestFocusInDescendants(VIEwGroup.java:2492)            at androID.vIEw.VIEwGroup.requestFocus(VIEwGroup.java:2451)            at androID.vIEw.VIEw.requestFocus(VIEw.java:7281)            at androID.vIEw.VIEwRootImpl.performTraversals(VIEwRootImpl.java:1898)            at androID.vIEw.VIEwRootImpl.doTraversal(VIEwRootImpl.java:1044)            at androID.vIEw.VIEwRootImpl$TraversalRunnable.run(VIEwRootImpl.java:5749)            at androID.vIEw.Choreographer$CallbackRecord.run(Choreographer.java:767)            at androID.vIEw.Choreographer.doCallbacks(Choreographer.java:580)            at androID.vIEw.Choreographer.doFrame(Choreographer.java:550)            at androID.vIEw.Choreographer$FramedisplayEventReceiver.run(Choreographer.java:753)            at androID.os.Handler.handleCallback(Handler.java:738)            at androID.os.Handler.dispatchMessage(Handler.java:95)            at androID.os.Looper.loop(Looper.java:135)            at androID.app.ActivityThread.main(ActivityThread.java:5070)            at java.lang.reflect.Method.invoke(Native Method)            at java.lang.reflect.Method.invoke(Method.java:372)            at com.androID.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:836)            at com.androID.internal.os.ZygoteInit.main(ZygoteInit.java:631)

解决方法:

此问题是由Lollipop的旧预览版本引起的.如果您将设备更新到最新的预览版本,则不会再出现此崩溃.

该评论提到该崩溃发生在2014年7月发布的LPV81C版本中.截至2014年10月27日的最新预览版本是LPX13D,没有此问题.

总结

以上是内存溢出为你收集整理的配备Android L的Nexus 5的Material Design全部内容,希望文章能够帮你解决配备Android L的Nexus 5的Material Design所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1077508.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-27
下一篇 2022-05-27

发表评论

登录后才能评论

评论列表(0条)

保存