Android Issues Collections 问题合集
2022-05-31 本文已影响0人
想看烟花么
执行gradlew build 报错:
Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changingorg.gradle.java.home
ingradle.properties
.
解决方案:根据错误提示在gradle:properties中指定如下配置:
org.gradle.java.home=C:/Program Files/Android/Android Studio/jre (refer to your path)
BottomSheetDialogFragment 相关issues,内容过多,键盘遮挡底部button时:
<item name="android:windowIsFloating">false</item>
<item name="android:windowSoftInputMode">adjustResize</item>
并且需要注意,中间的ScrollView必须是match_parent或者用layout_weight,如果用warp_content会计算不准确,导致依旧解决不了软键盘遮挡部分button的问题,正确的xml内容如下:
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:bind="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
<variable
name="theme"
type="com.greendotcorp.chatsdk.theme.ChatTheme" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:chat_background="@{theme.color.white}">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:chat_background="@{theme.color.white}">
<TextView
android:id="@+id/tv_label"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="start|center_vertical"
android:text="@string/chat_label"
android:visibility="invisible"
app:chat_font="@{theme.font.subTitleEmphasis}"
app:chat_marginLeft="@{theme.dimen.mediumMargin}"
app:chat_marginRight="@{theme.dimen.smallerMargin}"
app:chat_marginTop="@{theme.dimen.smallMargin}"
app:chat_textColor="@{theme.color.black}"
app:layout_constraintEnd_toStartOf="@+id/iv_minimize"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/iv_minimize"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="invisible"
app:layout_constraintEnd_toStartOf="@id/iv_close"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_chat_minimize" />
<ImageView
android:id="@+id/iv_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:chat_marginRight="@{theme.dimen.extraSmallMargin}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_chat_close" />
</androidx.constraintlayout.widget.ConstraintLayout>
<!--scrollView's 'layout_height' must be 'match_parent' or using 'layout_weight', can not use 'wrap_content',otherwise there is that keyboard covers layout issues-->
<androidx.core.widget.NestedScrollView
android:id="@+id/nestedScrollView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<Space
android:id="@+id/space1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
app:chat_marginTop="@{theme.dimen.mediumMargin*6}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/iv_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/space1" />
<TextView
android:id="@+id/tv_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center"
app:chat_font="@{theme.font.mediumTitleEmphasis}"
app:chat_marginLeft="@{theme.dimen.mediumMargin}"
app:chat_marginRight="@{theme.dimen.mediumMargin}"
app:chat_marginTop="@{theme.dimen.smallerMargin}"
app:chat_textColor="@{theme.color.black}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/iv_icon" />
<TextView
android:id="@+id/tv_description"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center"
app:chat_font="@{theme.font.regularText}"
app:chat_marginLeft="@{theme.dimen.mediumMargin}"
app:chat_marginRight="@{theme.dimen.mediumMargin}"
app:chat_marginTop="@{theme.dimen.smallerMargin}"
app:chat_textColor="@{theme.color.grey10}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_title" />
<androidx.constraintlayout.widget.Barrier
android:id="@+id/barrier_bottom"
android:layout_width="0dp"
android:layout_height="0dp"
app:barrierDirection="bottom"
app:constraint_referenced_ids="leave_msg_input,tv_error"
tools:layout_marginBottom="4dp" />
<include
android:id="@+id/leave_msg_input"
layout="@layout/edit_label_input_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_description"
app:theme="@{theme}" />
<TextView
android:id="@+id/tv_error"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="@color/error"
android:visibility="gone"
app:chat_font="@{theme.font.mediumText}"
app:chat_marginLeft="@{theme.dimen.mediumMargin}"
app:chat_marginRight="@{theme.dimen.mediumMargin}"
app:chat_marginTop="@{theme.dimen.smallerMargin}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/leave_msg_input" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
<TextView
android:id="@+id/tv_primary_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
app:chat_font="@{theme.font.subTitle}"
app:chat_layout_height="@{theme.dimen.largeMargin*2}"
app:chat_marginLeft="@{theme.dimen.mediumMargin}"
app:chat_marginRight="@{theme.dimen.mediumMargin}"
app:chat_marginTop="@{theme.dimen.mediumMargin}" />
<Space
android:id="@+id/space2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:chat_marginTop="@{theme.dimen.mediumMargin*6}" />
<Space
android:id="@+id/bottomSpace"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:chat_layout_height="@{theme.dimen.mediumMargin}" />
</LinearLayout>
</layout>
-----------------------------End-----------------------------