Bottomsheet Dialog隐藏UI元素

时间:2017-11-21 08:56:21

标签: android

我正在尝试使用带有编辑文本的底部对话框,我有这些屏幕截图:

enter image description here

enter image description here

在第二张图片中,键盘会剪切UI元素,应该将布局推到一起。

这是我的代码

public void setUpBottomSheetDialog() {
    View bottomSheetDialog = getLayoutInflater().inflate(R.layout.bottom_layout2, null);
    bsDialog = new BottomSheetDialog(MainActivity.this);
    bsDialog.setContentView(bottomSheetDialog);
    bsDialog.setCanceledOnTouchOutside(false);
    bsDialog.setCancelable(true);

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="100dp"
android:orientation="vertical"
app:behavior_hideable="false"
app:behavior_peekHeight="56dp"
app:layout_behavior="android.support.design.widget.BottomSheetBehavior">
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="30dp"
    android:gravity="center"
    android:orientation="horizontal"
    android:weightSum="1">
    <ImageView
        android:id="@+id/bs_imv_tag"
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:layout_gravity="center"
        app:srcCompat="@mipmap/ic_launcher_round" />
  <EditText
        android:id="@+id/bs_Etx"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="5dp"
        android:layout_marginRight="5dp"
        android:layout_weight="0.99"
        android:ems="10"
        android:hint="type your note"
        android:inputType="textCapSentences|textMultiLine"
        android:maxHeight="80dp"
        android:maxLines="4"
        android:textColor="#000"
        android:textColorHint="#4e97bc" />
    <ImageView
        android:id="@+id/bs_imv_save"
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:layout_gravity="center"
        app:srcCompat="@mipmap/ic_launcher_round" />
</LinearLayout>
 <View
    android:layout_width="match_parent"
    android:layout_height="40dp" />
</LinearLayout>

你可以提示我修改一下吗?

1 个答案:

答案 0 :(得分:0)

尝试使用

library(shiny)
library(shinyWidgets)

ui <- fluidPage(
  dropdownButton(
    actionButton("button", "Press this Button to close the dropdownButton!"),
    circle = TRUE, status = "primary", icon = icon("user-circle")
  )
)

server <- function(input, output) {
  observeEvent(
    input$button, {
      # Set dropdownButton closed
      print("Test")
    }
  )

}

shinyApp(ui = ui, server = server)

Reference this question