android - How to create chat-like footer layout in Xamarin Forms? -


i'm using xamarin forms create chat-like app abdroid , uwp. want create footer layout looks this (meaning 2 buttons , editor in horizontal orientation).

i have created layout in image using following xaml:

<grid >         <grid.margin>             <onplatform x:typearguments="thickness">                 <on platform="android">5,0,5,5</on>                 <on platform="windows">5,0,5,25</on>             </onplatform>         </grid.margin>         <grid.columndefinitions>             <columndefinition width="*"></columndefinition>             <columndefinition width="auto"></columndefinition>             <columndefinition width="auto"></columndefinition>         </grid.columndefinitions>          <editor x:name="messagetext"  text="" grid.column="0" />         <local:roundedbutton x:name="button2" clicked="click2"  backgroundcolor="#000000" grid.column="1" widthrequest="50" heightrequest="50" borderradius="25" verticaloptions="center" />         <local:roundedbutton x:name="button1" clicked="click1"  backgroundcolor="#000000" grid.column="2" widthrequest="50" heightrequest="50" borderradius="25" verticaloptions="center"/> </grid> 

the problem layout editor doesn't display more 1 line. when continue writing text longer editor's width this. can see first line cut-of , bottom of displayed when start new line.

as far know, pretty easy create kind of layout in android using linearlayout , layout_weight attribute. try avoid creating renderer whole footer now.

edit

here example wrote in android wanted result:

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:orientation="horizontal"     android:layout_width="match_parent"     android:layout_height="match_parent" >   <edittext      android:layout_height="wrap_content"     android:layout_width="0dp"     android:layout_weight="1"     android:hint="enter message"/>   <button     android:layout_height="wrap_content"     android:layout_width="wrap_content"     android:text="hi"/>   <button     android:layout_height="wrap_content"     android:layout_width="wrap_content"     android:text="bi"/> </linearlayout> 

here result:

wanted result

to grow editor when text changes, want trigger invalidatemeasure method force layout resize. it's protected method, need subclass editor control , make following change:

public class customeditor : editor {           public customeditor ()          {         textchanged += (sender, e) =>          {              invalidatemeasure();          };          }  } 

Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -