我想在 Android 的默认键盘上方添加一个按钮,并且我想重复使用很多次。
像这样:
那么,在这种情况下,我是否需要创建一个新的自定义键盘,或者有没有办法在每次我想要键盘上方的这个按钮时以编程方式添加这个按钮?
谁能推荐正确的方法。非常感谢任何帮助。谢谢
最佳答案
首先...这就像一个把戏...在您的布局中添加以下代码
<RelativeLayout
android:id="@+id/footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:gravity="center">
<Button
android:id="@+id/sendMsgButton"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_margin="0dp"
android:layout_marginBottom="20dp"
android:layout_marginTop="20dp"
android:background="#FF9800"
android:text="This button"
android:textSize="20dp"
android:textColor="#ffffff" />
</RelativeLayout>
然后通过在正确的位置使用 hese 2 代码动态显示或隐藏它(在键盘监听器中):
button.setVisibility(View.VISIBLE)
button.setVisibility(View.INVISIBLE)
关于android - 在键盘 android 上方添加按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37480176/