android - Having a dialog with a scrollview and persistent buttons at the bottom -


i having trouble creating layout dialog want display dialog scrollview buttons showing @ bottom when scrollview gets big pushes buttons @ bottom off screen.

i can desired effect if align buttons @ bottom of parent true if scrollview has little content in there big dialog lot of empty space.

here have

<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" >      <scrollview     android:id="@+id/scrollview1"     android:layout_width="match_parent"     android:layout_height="wrap_content">          <linearlayout             android:layout_width="fill_parent"             android:layout_height="wrap_content"             android:orientation="vertical" >          <textview             android:id="@+id/stacalcompany"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_marginbottom="20dp"             android:layout_marginleft="15dp"             android:layout_margintop="30dp"             android:text="company name"             android:textappearance="?android:attr/textappearancemedium"             android:textcolor="#ff2525"             android:textsize="25sp" />          <linearlayout             android:id="@+id/linearlayout1"             android:layout_width="match_parent"             android:layout_height="wrap_content" >              <textview                 android:id="@+id/stacalstart"                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:layout_marginleft="15dp"                 android:text="start:"                 android:textappearance="?android:attr/textappearancemedium"                 android:textcolor="#ff2525" />              <textview                 android:id="@+id/stacalstartdisp"                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:layout_marginleft="10dp"                 android:text="start time"                 android:textappearance="?android:attr/textappearancemedium" />         </linearlayout>          <linearlayout             android:id="@+id/linearlayout2"             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:layout_marginbottom="20dp" >              <textview                 android:id="@+id/stacalend"                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:layout_marginleft="15dp"                 android:text="end:"                 android:textappearance="?android:attr/textappearancemedium"                 android:textcolor="#ff2525" />              <textview                 android:id="@+id/stacalenddisp"                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:layout_marginleft="10dp"                 android:text="end time"                 android:textappearance="?android:attr/textappearancemedium" />         </linearlayout>          <textview             android:id="@+id/stacalsubdisp"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:layout_marginbottom="10dp"             android:layout_marginleft="15dp"             android:text="name"             android:textappearance="?android:attr/textappearancemedium"             android:textcolor="#ff2525" />          <textview             android:id="@+id/stacaldesc"             android:layout_width="285dp"             android:layout_height="wrap_content"             android:layout_marginbottom="20dp"             android:layout_marginleft="15dp"             android:text="description"             android:textappearance="?android:attr/textappearancemedium" />         </linearlayout>         </scrollview>  <relativelayout             android:id="@+id/linearlayout3"             android:layout_width="match_parent"             android:layout_height="60dp"             android:layout_gravity="bottom|center_horizontal"              android:gravity="center_horizontal"              android:layout_below="@+id/scrollview1">              <imagebutton                 android:id="@+id/caliconsync"                 android:layout_width="60dp"                 android:layout_height="60dp"                 android:layout_marginleft="20dp"                 android:background="@drawable/calendar_plus" />              <imagebutton                 android:id="@+id/btnstacalclose"                 android:layout_width="60dp"                 android:layout_height="60dp"                 android:layout_alignparentright="true"                 android:layout_marginright="20dp"                 android:background="@drawable/closepopup" />         </relativelayout> 

trying display correctly in both landscape , portrait mode when 1 works other not.

any suggestions on how go doing this?

in these cases create other invisible dummy buttons below , align these in such way "real" buttons positioned correctly.

if dummy buttons pushed off screen that's fine, real buttons above them. if there little stuff on screen dummy buttons @ bottom , "real" buttons somewhere in middle.

make "invisible" buttons width = "1dp" , height as need. leave them visible in android sense

edit: create relativeview aligns bottom bottom of list view , give maxheight. align buttons below relative view. when listview small buttons positioned right below it, if listview long relative view exceeds maxheight , ensures still on screen buttons right below maxheight. make sure maxheight of relativeview leaves enough room on bottom of screen buttons.

to adjust maxheight leaves enough room buttons on screen size may use screensize of device , adjust maxhight accordingly screenheight:

display display = getwindowmanager().getdefaultdisplay(); point size = new point(); display.getsize(size); int screenhheight = size.y; 

hope helps in case...


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -