Reputation: 4832
I implemented this emoji keyboard: https://github.com/ankushsachdeva/emojicon
On the right side, you can see that the popup just doesn'fit right. It doesn't wholly cover the keyboard. There is still some blue from the keyboard on the left, right and on the bottom. Maybe even a little bit on the top.
I think there is a mistake in the EmojiconsPopup.java
/**
* Call this function to resize the emoji popup according to your soft keyboard size
*/
public void setSizeForSoftKeyboard(){
rootView.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
Rect r = new Rect();
rootView.getWindowVisibleDisplayFrame(r);
int screenHeight = getUsableScreenHeight();
int heightDifference = screenHeight - (r.bottom - r.top);
int resourceId = mContext.getResources()
.getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0) {
heightDifference -= mContext.getResources().getDimensionPixelSize(resourceId);
}
if (heightDifference > 100) {
keyBoardHeight = heightDifference;
setSize(LayoutParams.MATCH_PARENT, keyBoardHeight);
if(isOpened == false){
if(onSoftKeyboardOpenCloseListener != null)
onSoftKeyboardOpenCloseListener.onKeyboardOpen(keyBoardHeight);
}
isOpened = true;
if(pendingOpen){
showAtBottom();
pendingOpen = false;
}
}
else{
isOpened = false;
if(onSoftKeyboardOpenCloseListener != null)
onSoftKeyboardOpenCloseListener.onKeyboardClose();
}
}
});
}
Am I the only one with this problem? Someone already fixed that? Thanks!
EDIT: emojicons.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="#a16b37"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/emojis_tab"
android:layout_width="match_parent"
android:layout_height="50dip"
android:layout_alignParentTop="true"
android:orientation="horizontal">
<ImageButton
android:background="@null"
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="1"
android:scaleType="center"
android:id="@+id/emojis_tab_0_recents"
android:src="@drawable/ic_emoji_recent_light"/>
<View
android:layout_width="1px"
android:layout_height="match_parent"
android:background="#382209"/>
<ImageButton
android:background="@null"
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="1"
android:scaleType="center"
android:id="@+id/emojis_tab_1_people"
android:src="@drawable/ic_emoji_people_light"/>
<View
android:layout_width="1px"
android:layout_height="match_parent"
android:background="#382209"/>
<ImageButton
android:background="@null"
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="1"
android:scaleType="center"
android:id="@+id/emojis_tab_2_nature"
android:src="@drawable/ic_emoji_nature_light"/>
<View
android:layout_width="1px"
android:layout_height="match_parent"
android:background="#382209"/>
<ImageButton
android:background="@null"
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="1"
android:scaleType="center"
android:id="@+id/emojis_tab_3_objects"
android:src="@drawable/ic_emoji_objects_light"/>
<View
android:layout_width="1px"
android:layout_height="match_parent"
android:background="#382209"/>
<ImageButton
android:background="@null"
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="1"
android:scaleType="center"
android:id="@+id/emojis_tab_4_cars"
android:src="@drawable/ic_emoji_places_light"/>
<View
android:layout_width="1px"
android:layout_height="match_parent"
android:background="#382209"/>
<ImageButton
android:background="@null"
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="1"
android:scaleType="center"
android:id="@+id/emojis_tab_5_punctuation"
android:src="@drawable/ic_emoji_symbols_light"/>
<View
android:layout_width="1px"
android:layout_height="match_parent"
android:background="#382209"/>
<ImageButton
android:background="@null"
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="@+id/emojis_backspace"
android:src="@drawable/sym_keyboard_delete_holo_dark"/>
</LinearLayout>
<android.support.v4.view.ViewPager
android:layout_below="@id/emojis_tab"
android:id="@+id/emojis_pager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" />
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_below="@id/emojis_tab"
android:background="#382209"/>
</RelativeLayout>
Upvotes: 0
Views: 544
Reputation: 13558
I almost sure that the problem here is the shadow-border around your PopUpWindow
.
You can try to change the EmojiconsPopup constructor and remove the background:
public EmojiconsPopup(View rootView, Context mContext){
super(mContext);
this.mContext = mContext;
this.rootView = rootView;
View customView = createCustomView();
setContentView(customView);
setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
//default size
setSize((int) mContext.getResources().getDimension(R.dimen.keyboard_height), LayoutParams.MATCH_PARENT);
//>>>>>> REMOVE BACKGROUND <<<<<<
setBackgroundDrawable(new ColorDrawable(0));
}
The key part here is using:
setBackgroundDrawable(new ColorDrawable(0));
to remove the background from the popup.
Upvotes: 2