android - Improper placing of relativelayout fields -


only textview1 appearing on screen, button , edittext box not appearing. please check code. new android development. believe placement of edittext , button incorrect.

<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:orientation="vertical" >      <textview         android:id="@+id/textview1"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="@string/textview1" />      <edittext         android:id="@+id/edit_message"         android:layout_width="match_parent"         android:layout_height="10dp"         android:layout_alignparentleft="true"         android:layout_below="@+id/textview1"         android:layout_margintop="10dp"         android:ems="10"         android:hint="@string/edit_message"/>      <button         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_below="@+id/edit_message"         android:layout_margintop="49dp"         android:layout_torightof="@+id/edit_message"         android:onclick="sendmessage"         android:text="@string/button_send" />   </relativelayout> 

relativelayout doesn't have orientation property...remove that. also, think want remove margintop properties if putting them below other views. may want use padding instead. i'm not sure if can right of , below same view may work. that's see @ moment

note

fill_parent depricated. it's ok use might accustomed using match_parent instead

i got code working suggestions gave. see below. note height of 10dp may not see because isn't big

<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" >  <textview     android:id="@+id/textview1"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:text="textview1" />  <edittext     android:id="@+id/edit_message"     android:layout_width="match_parent"     android:layout_height="10dp"     android:layout_alignparentleft="true"     android:layout_below="@+id/textview1"     android:ems="10"     android:hint="edit_message"/>  <button     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_below="@+id/edit_message"     android:onclick="sendmessage"     android:text="button_send" /> </relativelayout> 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -