Android 如何实现此材质设计功能?(按钮浮动在键盘上方)
请检查这个屏幕截图 如何在android中添加这样的按钮。有图书馆吗,或者叫什么 请注意,隐藏键盘时,此按钮会占用导航按钮的空间 另一个问题:当键盘显示或隐藏时,如何更改蓝色应用程序栏的大小 **更新:**我可以在框架布局中使用无边界按钮并将重力设置为底部,实现类似的布局。然后我使用了android:WindowsOfInputMode=“adjustResize” 在清单文件中,使其与键盘隐藏/取消隐藏一起工作。不过,这些按钮并没有占用导航按钮的空间。还需要在键盘上显示更改应用程序栏大小的指南。您可以使用 1-Android 如何实现此材质设计功能?(按钮浮动在键盘上方),android,user-interface,material-design,Android,User Interface,Material Design,请检查这个屏幕截图 如何在android中添加这样的按钮。有图书馆吗,或者叫什么 请注意,隐藏键盘时,此按钮会占用导航按钮的空间 另一个问题:当键盘显示或隐藏时,如何更改蓝色应用程序栏的大小 **更新:**我可以在框架布局中使用无边界按钮并将重力设置为底部,实现类似的布局。然后我使用了android:WindowsOfInputMode=“adjustResize” 在清单文件中,使其与键盘隐藏/取消隐藏一起工作。不过,这些按钮并没有占用导航按钮的空间。还需要在键盘上显示更改应用程序栏大小的指
2-好吧,我想说这个按钮与键盘没有任何关系。我打赌它只是一个
FrameLayout
中带有android:layout\u gravity=“bottom”
属性集的按钮。它是一个放置在容器中的无边界按钮(可能是LinearLayout
)
容器本身称为buttonBar
无边框按钮
一种有用的设计是“无边界”按钮。无边界
按钮类似于基本按钮,只是它们没有边框或边框
背景,但在不同状态下仍会改变外观,例如
就像单击时一样
要创建无边框按钮,请应用无边框按钮样式
按一下按钮。例如:
<Button
android:id="@+id/button_send"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/button_send"
android:onClick="sendMessage"
style="?android:attr/borderlessButtonStyle" />
用于按钮栏
通过在滚动视图中保留除buttonBar之外的整个视图,可以实现其他所有内容的折叠效果以及此按钮栏位于操作键盘顶部的效果。将此作为参考。在ScrollView中插入布局
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lines="1"
/>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="button"
/>
</LinearLayout>
</LinearLayout>
我将尝试一下,检查按钮是否位于键盘顶部。感谢您指出这些libsI,我认为AppIntro是最好的。您可以在滑块中放置一个custum片段。当我将FrameLayout的布局设置为“底部”时,按钮会显示在底部,但不会停留在键盘顶部
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:lines="1"
/>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="button"
/>
</LinearLayout>
</LinearLayout>