1

I want to add a button above the default keyboard in Android and I want to reuse a lot of times.

Something like this:

button above keyboard

So, in such a case, do I need to create a new Custom keyboard OR is there a way to add this button programmatically every time i want this button above the keyboard?

Can anyone recommend the right way to go. Any help is highly appreciated. Thanks

2 Answers 2

1

First of all...It just like a trick...Add the following code in your layout

 <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> 

Then dynamically show or hide this(in keyboard listener) by using hese 2 code on the right places:

button.setVisibility(View.VISIBLE) button.setVisibility(View.INVISIBLE) 
Sign up to request clarification or add additional context in comments.

Comments

0

I think the way to go is implementing a listener to check if the keyboard is visible and toggling the visibility of the button. For the button I suggest using a RelativeLayout or FrameLayout as the parent view with the button aligned to the bottom.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.