小编Ogn*_*kov的帖子

Android 4.4 KitKat随机崩溃(/system/lib/libc.so上的本机崩溃)

我构建了一个应用程序,通过WebView播放YouTube iframe视频,并使用YouTube iframe api控制视频.

(我知道适用于Android的YouTube SDK可能更适合Android应用开发,但目前只有iframe api符合我们的需求)

我发现在Android 4.4 KitKat下运行时应用程序会随机崩溃.

这是Google Play控制台的完整崩溃日志:

Native crash at /system/lib/libc.so
in /system/lib/libc.so (tgkill+12), /system/lib/libc.so (pthread_kill+48)

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'samsung/lt02ltespr/lt02ltespr:4.4.2/KOT49H/T217SVPUBNH4:user/release-keys'
Revision: '9'
pid: 10404, tid: 10660, name: rbbb.myapp >>> com.kkkkrbbb.myapp <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
r0 00000000 r1 000029a4 r2 00000006 r3 00000000
r4 00000006 r5 00000000 r6 000029a4 r7 0000010c
r8 630b10d0 r9 578211e8 …
Run Code Online (Sandbox Code Playgroud)

android android-webview android-youtube-api android-4.4-kitkat

23
推荐指数
1
解决办法
6243
查看次数

ConstraintLayout边距不起作用

marginTop如果我所约束的视图可见性消失,则使用下面的xml 会被忽略.

目前最新的布局lib版本会发生这种情况 com.android.support.constraint:constraint-layout:1.0.0-beta4

例:

tvMessageivCommentImagevisible-在16DP上边距llLeftActionsllRightActions工作正常.如果ivCommentImagegone边距被忽略.

<android.support.v7.widget.CardView
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

<android.support.constraint.ConstraintLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="16dp">

<!-- some more views here -->

    <TextView
        android:id="@+id/tvMessage"
        style="@style/SocialFeed.Description"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginEnd="16dp"
        android:layout_marginLeft="16dp"
        android:layout_marginRight="16dp"
        android:layout_marginStart="16dp"
        android:layout_marginTop="16dp"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/ivProfile"
        app:layout_goneMarginTop="0dp"
        tools:text="@string/lorem_ipsum_140chars"/>

    <android.support.v7.widget.AppCompatImageView
        android:id="@+id/ivCommentImage"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginTop="16dp"
        android:adjustViewBounds="true"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/tvMessage"
        app:layout_goneMarginTop="0dp"
        />

    <android.support.constraint.Guideline
        android:id="@+id/gCenter"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:layout_constraintGuide_percent="0.5"/>

    <LinearLayout
        android:id="@+id/llLeftActions"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginTop="16dp"
        android:gravity="center_vertical|left"
        android:orientation="horizontal"
        app:layout_constraintLeft_toLeftOf="@+id/tvMessage"
        app:layout_constraintRight_toLeftOf="@+id/gCenter"
        app:layout_constraintTop_toBottomOf="@+id/ivCommentImage"
        app:layout_goneMarginTop="0dp"
        />

    <LinearLayout
        android:id="@+id/llRightActions" …
Run Code Online (Sandbox Code Playgroud)

android android-xml android-constraintlayout

11
推荐指数
1
解决办法
1万
查看次数

不要在RecyclerView中回收特定的视图类型

我有一个重用视图的循环器视图,我的问题是一个视图包含ViewPager,如果recyclelerview的适配器重用视图所在的视图,那么viewpager会发生异常.但是,onCreateViewHolder方法仅在第一次调用时才会被调用.我怎么能避免这种行为并实现onCreateViewHolder可以被多次调用?

提前致谢

android android-adapter android-viewpager android-recyclerview

7
推荐指数
1
解决办法
3680
查看次数

以编程方式设置TextInputLayout的样式

有没有一种方法可以通过编程方式自定义这些TextInputLayout属性:

  • textColorHint
  • colorAccent
  • colorControlNormal
  • colorControlActivated
  • textSelectHandle

我知道如何使用主题属性设置样式,但是我正在研究的项目会动态加载颜色信息,据我所知,无法在运行时更改主题/样式值。

android android-theme android-styles android-textinputlayout

6
推荐指数
1
解决办法
2731
查看次数