相关疑难解决方法(0)

如何在AlertDialog中设置正负按钮的顺序?

为什么我想这样做完全是另一个讨论,但我需要弄清楚让所有警报对话框在右侧都有正面按钮的最佳方法.请注意,在3.0版及更低版本中,按钮通常显示为"确定/取消",而在4.0及更高版本中则为"取消/确定".我想强制我的应用程序以最简单的方式使用取消/确定.我在应用程序中有很多AlertDialogs.

android android-alertdialog

19
推荐指数
2
解决办法
2万
查看次数

键盘建议导致部分Android EditText.setError()消息无法显示

当我edittext.setError("enter a comment")在android中使用时,它工作正常,直到键盘建议出现并且错误被推到上面edittext,之后它不显示整个错误消息.

它为什么这样做?

进入文本框后,气球弹出窗口现在显示在文本框上方

android set android-edittext

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

Cardview中的ConstraintLayout添加了空白区域

我想创建一个CardView具有ConstraintLayout组织一些TextView.

有时它会按预期显示,但有时会增加额外的空白区域,例如键盘关闭时会破坏布局.我有一个GIF下面显示CardView工作,而不是在相同的时间段内工作.

ConstraintLayout添加空白区域

相关的代码段CardView如下.我wrap_content试图保持CardView我想要的大小,但它仍然扩大.

    <android.support.v7.widget.CardView
    android:id="@+id/cardView_game_cash"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_margin="6dp"
    app:cardCornerRadius="4dp"
    app:contentPadding="6dp"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent">

    <android.support.constraint.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <TextView
            android:id="@+id/textView_game_cashLabel"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:text="Total Cash"
            app:layout_constraintLeft_toLeftOf="@+id/textView_game_cash"
            app:layout_constraintRight_toRightOf="@+id/textView_game_cash"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            android:id="@+id/textView_game_totalProfitLabel"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:text="Total Profit"
            app:layout_constraintLeft_toLeftOf="@+id/textView_game_totalProfit"
            app:layout_constraintRight_toRightOf="@+id/textView_game_totalProfit"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            android:id="@+id/textView_game_profitLabel"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:text="Win Profit"
            app:layout_constraintLeft_toLeftOf="@+id/textView_game_profit"
            app:layout_constraintRight_toRightOf="@+id/textView_game_profit"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            android:id="@+id/textView_game_cash"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:background="@color/colorAccent"
            android:gravity="center"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toLeftOf="@+id/textView_game_totalProfit"
            app:layout_constraintTop_toBottomOf="@+id/textView_game_cashLabel"
            tools:text="TextView" />

        <TextView
            android:id="@+id/textView_game_totalProfit"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:background="@color/colorPrimary"
            android:gravity="center" …
Run Code Online (Sandbox Code Playgroud)

xml android android-layout android-cardview android-constraintlayout

3
推荐指数
1
解决办法
2514
查看次数