我有一个非常简单的布局,我使用Design Support Library中的新android.support.design.widget.TextInputLayout视图
<android.support.design.widget.TextInputLayout
android:id="@+id/til"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/textDialog"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="First Name"/>
</android.support.design.widget.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)
在膨胀时,我得到例外:
Caused by: java.lang.RuntimeException: Failed to resolve attribute at index 18
at android.content.res.TypedArray.getColor(TypedArray.java:401)
at android.support.design.widget.CollapsingTextHelper.setCollapsedTextAppearance(CollapsingTextHelper.java:166)
at android.support.design.widget.TextInputLayout.<init>(TextInputLayout.java:106)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:607)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:381)
at android.app.Activity.setContentView(Activity.java:2144)
at com.example.trybindinglib.MainActivity.onCreate(MainActivity.java:24)
at android.app.Activity.performCreate(Activity.java:5933)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2407)
at android.app.ActivityThread.access$800(ActivityThread.java:149)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1324)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:211)
at android.app.ActivityThread.main(ActivityThread.java:5321)
at java.lang.reflect.Method.invoke(Native Method)
at …Run Code Online (Sandbox Code Playgroud) 我们之前开发了一个应用程序,用于软糖到牛轧糖,但现在我们在视觉工作室更新我们的xamarin后出现了问题.
以前,我们的apk完全在所有Android版本中运行,但现在更新后,它现在崩溃...但仅在5.1.1.我们已经用kitkat,棒棒糖5.1,棉花糖和牛轧糖进行了测试,它确实在运行.
我们注意到我们的应用程序在OnCreate方法中的最后一个大括号"}"之后崩溃了.它在没有事先细节的情况下发布了一个例外.
这个例外的原因是什么?或任何解决方案,如果有人已经解决它.
我不知道它是否只是由于xamarin更新而改变的设置.
例外情况仅发生在OPPO手机上,在其他5.1和5.1.1版本上进行了测试
Exception image is here and as I said, there is no single detail
Here is the debugger output
Android application is debugging.
Mono Warning: option gen-compact-seq-points is deprecated.
07-14 10:37:16.613 W/monodroid(18119): Trying to load sgen from: /data/app/RBOS_2.x_0.x_1.RBOS_2.x_0.x_1-1/lib/arm/libmonosgen-2.0.so
07-14 10:37:16.613 W/monodroid-debug(18119): Trying to initialize the debugger with options: --debugger-agent=transport=dt_socket,loglevel=0,address=127.0.0.1:29342,server=y,embedding=1
07-14 10:37:16.953 W/monodroid-debug(18119): Accepted stdout connection: 29
07-14 10:37:18.793 W/monodroid-gc(18119): GREF GC Threshold: 46080
07-14 10:37:18.793 W/monodroid(18119): Calling into managed runtime init
Loaded assembly: RBOS 2.0.1.dll …Run Code Online (Sandbox Code Playgroud) 这段代码工作似乎在android api 16 - 22中工作但在api 23中不起作用.我只是试图在其中显示一个带有选项的popupwindow并将背景调暗到popupwindow下面:
WindowPopUp windowPopUp =
new WindowPopUp(mContext, mPlaces.get(position), position, fromSearch);
windowPopUp.showAtLocation(v, Gravity.CENTER, 0, 0);
View parent = (View) windowPopUp.getContentView().getParent();
//dim the window in the background
WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
WindowManager.LayoutParams p = (WindowManager.LayoutParams) parent.getLayoutParams();
p.flags = WindowManager.LayoutParams.FLAG_DIM_BEHIND;
p.dimAmount = 0.4f;
wm.updateViewLayout(parent, p);
Run Code Online (Sandbox Code Playgroud)
运行此代码会导致错误:
03-18 21:55:19.674 8814-8814/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.myapp, PID: 8814
java.lang.ClassCastException: android.widget.FrameLayout$LayoutParams cannot be cast to android.view.WindowManager$LayoutParams
at com.bemyapp.adapter.OuterPlaceAdapter$5.onLongClick(OuterPlaceAdapter.java:400)
at android.view.View.performLongClick(View.java:5237)
at android.view.View$CheckForLongPress.run(View.java:21121)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417) …Run Code Online (Sandbox Code Playgroud) android layoutparams android-popupwindow android-6.0-marshmallow