weird behaviour
hvar90 opened this issue · 6 comments
hi
i wanna to have a behaviour like whatsapp with the side buttons, where the side buttons are fixed at bottom no matter the height of the input text size
i have used relative layout with android:layout_alignParentBottom="true"
and i have used android:layout_gravity="bottom" android:gravity="bottom" with a linear layout but that did not work
Hello. Can you provide xml file of your layout?
of course
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:emojicon="http://schemas.android.com/apk/res-auto"
android:id="@+id/root_view"
android:background="@drawable/wallpaper"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="0dp"
android:paddingBottom="5dp"
android:paddingRight="6dp"
android:paddingLeft="6dp"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="schan.main.ChatActivity"
tools:showIn="@layout/activity_chat">
<com.dewarder.holdinglibrary.HoldingButtonLayout
android:id="@+id/input_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
app:hbl_cancel_icon="@drawable/ic_close_black_24dp"
app:hbl_holding_view="@+id/start_record"
app:hbl_icon="@drawable/ic_mic_white_24dp"
app:hbl_radius="@dimen/activity_main_holding_button_radius"
app:hbl_second_radius="@dimen/activity_main_holding_button_second_radius">
<LinearLayout
android:id="@+id/slide_to_cancel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="48dp"
android:layout_gravity="bottom|center_horizontal"
android:gravity="center_vertical|center"
android:background="@android:color/white"
android:visibility="invisible">
<TextView
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0:00"
android:textSize="25dp"
/>
<ImageView
android:layout_width="@dimen/activity_main_slide_to_cancel_icon_size"
android:layout_height="@dimen/activity_main_slide_to_cancel_icon_size"
android:layout_marginEnd="@dimen/activity_main_slide_to_cancel_icon_margin_right"
android:layout_marginRight="@dimen/activity_main_slide_to_cancel_icon_margin_right"
android:scaleType="center"
android:src="@drawable/ic_keyboard_arrow_left_black_24dp"/>
<TextView
android:id="@+id/textView_to_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/label_slide_to_cancel"/>
</LinearLayout>
<LinearLayout
android:id="@+id/box_emoji_input_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:gravity="bottom" >
<ImageView
android:id="@+id/emoji_btn"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:minHeight="48dp"
android:background="@android:color/white"
android:src="@drawable/smiley"
/>
<com.vanniktech.emoji.EmojiEditText
android:id="@+id/emojicon_edit_text"
android:layout_weight="1"
android:paddingBottom="@dimen/activity_main_input_padding_vertical"
android:paddingTop="@dimen/activity_main_input_padding_vertical"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:hint="@string/typeMessage"
android:textColorHint="#bcbcbc"
android:inputType="textCapSentences|textAutoCorrect|textMultiLine"
android:minHeight="48dp"
android:background="@android:color/white"
emojicon:emojiSize="26dp" />
<ImageView
android:id="@+id/submit_btn"
android:layout_marginRight="@dimen/input_margin_right"
android:background="@android:color/white"
android:minHeight="48dp"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:src="@drawable/ic_action_send_now"
/>
<ImageView
android:id="@+id/start_record"
android:layout_width="@dimen/activity_main_start_record_width"
android:layout_height="@dimen/activity_main_start_record_height"
android:scaleType="center"
android:background="@drawable/round_image"
android:src="@drawable/ic_mic_white_24dp"/>
</LinearLayout>
</com.dewarder.holdinglibrary.HoldingButtonLayout>
<ListView
android:id="@+id/lv"
android:listSelector="@android:color/transparent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/input_holder"
android:layout_alignParentLeft="false"
android:layout_alignParentTop="false"
android:transcriptMode="normal"
android:divider="@null"
/>
</RelativeLayout>
Just set fixed or wrap_content
height for emoji_btn
and submit_btn
. Currently they take all possible height of parent so buttons are aligned to bottom but images inside ImageView
are centered.
i found the solution, i wrapped the button with another linear layout, thanks anyway... :)
<LinearLayout
android:background="@android:color/white"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="bottom" >
<ImageView
android:id="@+id/emoji_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="48dp"
android:background="@android:color/white"
android:src="@drawable/smiley"
/>
</LinearLayout>
Wrap emoji_btn
, emojicon_edit_text
, submit_btn
with another layout and set background for it. Currently it isn't issue of library.