Android 无法在软键盘上方显示bottomSheetDialogFragment
我正在使用软输入键盘重叠的Android 无法在软键盘上方显示bottomSheetDialogFragment,android,android-softkeyboard,android-bottomsheetdialog,Android,Android Softkeyboard,Android Bottomsheetdialog,我正在使用软输入键盘重叠的BottomSheetDialogFragment,因此我在这里尝试了许多现有的答案。喜欢但对我来说什么都不管用。我希望整个布局显示在键盘上方或仅显示编辑文本 这是我在XML文件中的设计结构 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" a
BottomSheetDialogFragment
,因此我在这里尝试了许多现有的答案。喜欢但对我来说什么都不管用。我希望整个布局显示在键盘上方或仅显示编辑文本
这是我在XML文件中的设计结构
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:gravity="center_horizontal"
android:orientation="vertical"
android:id="@+id/bottomSheetRoot"
android:background="@android:color/transparent"
tools:context=".fragments.JoinTeamFragment"
app:layout_behavior="@string/bottom_sheet_behavior">
<androidx.cardview.widget.CardView>
<androidx.core.widget.NestedScrollView>
<LinearLayout>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/join_dialog_description"/>
<androidx.cardview.widget.CardView>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/msg_from_author_tv"/>
</androidx.cardview.widget.CardView>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/join_dialog_instruction_msg"/>
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/message_et_join_team"
android:lines="5" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/join_message_tv_counter"/>
<LinearLayout>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/cancel_button_join"/>
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/confirm_button_join"/>
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.cardview.widget.CardView>
</LinearLayout>
class JoinTeamFragment : BottomSheetDialogFragment() {
private var mListener: BottomSheetListener? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setStyle(STYLE_NORMAL, R.style.CustomBottomSheetDialogTheme)
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
val view = inflater.inflate(R.layout.fragment_join_team, container, false)
{
}
interface BottomSheetListener
override fun onAttach(context:Context) {
super.onAttach(context)
try
{
mListener = context as BottomSheetListener
}
catch (e:ClassCastException) {
throw ClassCastException(("$context must implement BottomSheetListener"))
}
}
}