【问题标题】:BottomBar Moves With Keyboard (Android Studio)BottomBar 随键盘移动 (Android Studio)
【发布时间】:2023-03-22 02:12:02
【问题描述】:

我有这个代码:

 <TableLayout
        android:layout_gravity="bottom"
        android:stretchColumns="0,1,2"
        android:id="@+id/table1"
        android:layout_centerHorizontal="true"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        >
        <EditText
            android:layout_gravity="bottom"

            android:id="@+id/txtsearch"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:hint="Search"

            />
        <TableRow

            android:id="@+id/tableRowFive"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" >
            <ImageView
                android:src="@drawable/arrow"
                android:adjustViewBounds="true"
                android:maxWidth="40dp"
                android:maxHeight="40dp"
                android:scaleType="fitCenter"
                />
            <TextView
                android:layout_gravity="center_horizontal|bottom"
                android:text="Click To View"
                android:textSize="26dp"
                />

            <ImageView
                android:src="@drawable/arrow2"
                android:adjustViewBounds="true"
                android:maxWidth="40dp"
                android:maxHeight="40dp"
                android:scaleType="fitCenter"
                />
        </TableRow>

</TableLayout>

每当我单击 TableLayout 的 EditText 部分时,键盘都会像往常一样弹出,但 TableLayout 会随之出现。我希望 TableLayout 保持在底部,而不是跟随键盘。

【问题讨论】:

标签: android android-studio android-edittext android-tablelayout


【解决方案1】:

在清单中将其添加到活动中:

<application ... >
  <activity
    android:windowSoftInputMode="adjustPan" ... >
    ...
  </activity>
...
</application>

背后的逻辑是:

adjustResize = 调整页面内容的大小

adjustPan = 移动页面内容而不调整页面内容的大小

【讨论】:

  • 这没有任何作用。
  • 你在activity或fragment中有没有做adjustResize或adjustPan的代码?
猜你喜欢
  • 2021-09-10
  • 2013-11-08
  • 2018-01-12
  • 1970-01-01
  • 2016-09-13
  • 1970-01-01
  • 1970-01-01
  • 2019-02-22
  • 1970-01-01
相关资源
最近更新 更多