I have main RelativeLayout layout file. I have scrollview and two buttons and listview inside this scrollview.I have one problem , when i run program it show's only one item in listview.my problem is xml file. How i can change my problem?
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ScrollView
android:id="#+id/scrollview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<RelativeLayout
android:id="#+id/layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:background="#5f2585" >
<Button
android:id="#+id/studia"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:background="#drawable/n_button"
android:text="სტუდია"
android:textColor="#ffffff" />
<ListView
android:id="#+id/menu_listview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/studia"
android:divider="#null"
>
</ListView>
<Button
android:id="#+id/gadacema"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_below="#+id/menu_listview"
android:background="#drawable/n_button"
android:text="გადაცემა"
android:textColor="#ffffff" />
</RelativeLayout>
in programmatically everything is ok(if i deleted scrollview,then i can show all values,but i cannot show button witch is a below in listview
What is wrong in my xml file. How can i solve this problem?
Please try this.
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<RelativeLayout
android:id="#+id/layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="50dp"
android:background="#5f2585" >
<Button
android:id="#+id/studia"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:background="#drawable/n_button"
android:text="სტუდია"
android:textColor="#ffffff" />
<ListView
android:id="#+id/menu_listview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/studia"
android:divider="#null"
>
</ListView>
<Button
android:id="#+id/gadacema"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_below="#+id/menu_listview"
android:background="#drawable/n_button"
android:text="გადაცემა"
android:textColor="#ffffff" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
Try this:-
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<Button
android:id="#+id/studia"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:background="#drawable/n_button"
android:text="სტუდია"
android:textColor="#ffffff" />
<ListView
android:id="#+id/menu_listview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/studia"
android:divider="#null"/>
<Button
android:id="#+id/gadacema"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_below="#+id/menu_listview"
android:background="#drawable/n_button"
android:text="გადაცემა"
android:textColor="#ffffff" />
</RelativeLayout>
Related
I'm trying to position a few Cardviews below eachother in a RelativeLayout, but it isn't working out so far. The cardviews are all on top of eachother, but layout_below is set for all of them. It's pretty strange, because it did work in the past if I recall correctly.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com"
xmlns:android.support.v7.cardview="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context="something.something.fragments.RosterFragment"
android:id="#+id/relativeLayout"
android:background="#color/white"
tools:ignore="MergeRootFrame">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="false"
android:id="#+id/rosterContainer0">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:id="#+id/cardViewMonday"
android:longClickable="true"
style="#style/InformationCard">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="#style/TitleLightBackground"
android:text="Maandag"
android:id="#+id/dateMonday" />
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/rosterListViewMonday"
android:background="#color/white">
</ListView>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:id="#+id/cardViewTuesday"
android:longClickable="true"
style="#style/InformationCard"
android:layout_below="#+id/cardViewMonday">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="#style/TitleLightBackground"
android:text="Dinsdag"
android:id="#+id/dateTuesday" />
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/rosterListViewTuesday"
android:background="#color/white">
</ListView>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:id="#+id/cardViewWednesday"
android:longClickable="true"
style="#style/InformationCard"
android:layout_below="#+id/cardViewTuesday">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="#style/TitleLightBackground"
android:text="Maandag"
android:id="#+id/dateWednesday" />
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/rosterListViewWednesday"
android:layout_below="#+id/dateWednesday"
android:background="#color/white">
</ListView>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:id="#+id/cardViewThursday"
android:longClickable="true"
style="#style/InformationCard"
android:layout_below="#+id/cardViewWednesday">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="#style/TitleLightBackground"
android:text="Maandag"
android:id="#+id/dateThursday" />
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/rosterListViewThursday"
android:layout_below="#+id/dateThursday"
android:background="#color/white">
</ListView>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:id="#+id/cardViewFriday"
android:longClickable="true"
style="#style/InformationCard"
android:layout_below="#+id/cardViewThursday">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="#style/TitleLightBackground"
android:text="Maandag"
android:id="#+id/dateFriday" />
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/rosterListViewFriday"
android:layout_below="#+id/dateFriday"
android:background="#color/white">
</ListView>
</android.support.v7.widget.CardView>
</RelativeLayout>
</ScrollView>
Watch out when you copy - paste code.
All your cards have the attribute android:layout_alignParentTop="true"
I've tried everything, and looked up everywhere..!
I'm trying to put a listview within a scrollview, and a button at the bottom of the screen fixed..
This is my code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ListView
android:id="#android:id/list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/rlCommento" />
<RelativeLayout
android:id="#+id/rlCommento"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true" >
<EditText
android:id="#+id/etCCommento"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_weight="15"
android:ems="10" >
<requestFocus />
</EditText>
<Button
android:id="#+id/bCInviaCommento"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/etCCommento"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_weight="85"
android:text="Commenta!" />
</RelativeLayout>
</RelativeLayout>
It seems working in the project, but when I try it on the emulator, it doesn't work!
Any advice ? Thanks!
This is what you have to do:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:text="Button" />
<ListView
android:id="#+id/listView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/button1"
android:layout_centerHorizontal="true" >
</ListView>
</RelativeLayout>
You can use LinearLayout.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ListView
android:id="#android:id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<RelativeLayout
android:id="#+id/rlCommento"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
...
</RelativeLayout>
</LinearLayout>
First: Don't put list view inside scroll view
Second: make your top most parent width n height to match parent
Third: add a new layout at bottom and add button inside this layout, something like this, give layout some weight
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_weight="1"
android:orientation="horizontal"
android:paddingBottom="7dp"
android:paddingTop="7dp" >
<Button
android:id="#+id/score_board"
android:layout_width="wrap_content"
android:layout_height="55dp"
android:layout_gravity="center"
android:layout_weight="1"
android:text="OK" />
</LinearLayout>
// Try this way,hope this will help you to solve your problem...
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="5dp">
<ListView
android:id="#android:id/list"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"/>
<LinearLayout
android:id="#+id/rlCommento"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp">
<EditText
android:id="#+id/etCCommento"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10" >
<requestFocus />
</EditText>
<Button
android:id="#+id/bCInviaCommento"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="Commenta!" />
</LinearLayout>
</LinearLayout>
To do that you have to LinearLayout vertical instead of RelativeLayout and set ListView weight=1 and layout_height=0dp.
This should work just as needed:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ListView
android:id="#android:id/list"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<RelativeLayout
android:id="#+id/rlCommento"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<EditText
android:id="#+id/etCCommento"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_weight="15"
android:ems="10" >
<requestFocus />
</EditText>
<Button
android:id="#+id/bCInviaCommento"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/etCCommento"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_weight="85"
android:text="Commenta!" />
</RelativeLayout>
Hope I understood your problem correctly. No need of keeping ListView inside scrollview. Just try following snippet. It will may for you.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ListView
android:id="#android:id/list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<Button
android:id="#+id/bCInviaCommento"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="Commenta!"
android:layout_below="#id/list" />
</RelativeLayout?
I've made a layout that worked fine with a vertical scroll view, but I need to make another one with a horizontal scroll view.
I just changed ScrollView to HorizontalScrollView:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<HorizontalScrollView
android:layout_weight="1"
android:scrollbars="none"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:text="#string/activity_visibilidade_cronologia_aula_subtitulo"
android:textSize="16dp" />
<ImageButton
android:id="#+id/activity_visibilidade_cronologia_aula_btn_info"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:background="#null"
android:scaleType="fitXY"
android:src="#drawable/btn_info" />
</RelativeLayout>
<LinearLayout
android:id="#+id/activity_visibilidade_cronologia_aula_linear_conteudo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
</LinearLayout>
<Button
android:id="#+id/activity_visibilidade_cronologia_aula_btn_confimar"
android:layout_width="165dp"
android:layout_height="35dp"
android:layout_centerVertical="true"
android:layout_gravity="right"
android:layout_marginBottom="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:background="#drawable/botao_add_confirmar"
android:text="#string/dialogo_alterar_classe_confirmar"
android:textColor="#color/branco" />
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>
And its result is:
Why doesn't HorizontalScrollView fills the parent, is there something wrong?
I solved merging all your advices and also using android:fillViewport="true" my final code is:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<include layout="#layout/layout_titulo_views" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:text="#string/activity_visibilidade_cronologia_aula_subtitulo"
android:textSize="16dp" />
<ImageButton
android:id="#+id/activity_visibilidade_cronologia_aula_btn_info"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:background="#null"
android:scaleType="fitXY"
android:src="#drawable/btn_info" />
</RelativeLayout>
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:scrollbars="horizontal" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<LinearLayout
android:id="#+id/activity_visibilidade_cronologia_aula_linear_conteudo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
</LinearLayout>
</LinearLayout>
</HorizontalScrollView>
<Button
android:id="#+id/activity_visibilidade_cronologia_aula_btn_confimar"
android:layout_width="165dp"
android:layout_height="35dp"
android:layout_centerVertical="true"
android:layout_gravity="right"
android:layout_marginBottom="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:background="#drawable/botao_add_confirmar"
android:text="#string/dialogo_alterar_classe_confirmar"
android:textColor="#color/branco" />
</LinearLayout>
</LinearLayout>
Thank you all
I found teh problem. In addition to removing the weight sum, you need to change the linear layout orientation to horizontal.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
I am new in android. I am making an app using google map.
In the layout file 3 part i.e Top Layer,Mid Layer,Bottom Layer.
In Top layer a header, in bottom Layer TAB button.
In Mid Layer Fragment and Edit text. When I click on edit box then fragment gone up. when fragment comes back at position then hte top layer is going to invisible. I don't know what happens.
<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:background="#drawable/bg"
tools:context=".MainActivity" >
<RelativeLayout
android:id="#+id/topLay"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/jam_alert_topbar"
>
</RelativeLayout>
<RelativeLayout
android:id="#+id/midLay"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="#+id/botLay"
android:layout_below="#+id/topLay"
android:layout_margin="10dp" >
<fragment
android:id="#+id/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="#+id/descr"
android:layout_below="#+id/topLay"
class="com.google.android.gms.maps.SupportMapFragment" />
<EditText
android:id="#+id/descr"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_marginTop="5dp"
android:background="#color/white"
android:gravity="top|left"
android:hint="Description"
android:maxLines="4"
android:minLines="4" >
</EditText>
</RelativeLayout>
<LinearLayout
android:id="#+id/botLay"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:gravity="center" >
<Button
android:id="#+id/btReport"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/jam_tab_n"
android:onClick="btReport" />
<Button
android:id="#+id/btMap"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/map_tab_h"
android:onClick="btMap" />
<Button
android:id="#+id/btHome"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/report_tab_n"
android:onClick="btHome" />
<Button
android:id="#+id/btSetting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/settings_tab_n"
android:onClick="btSetting" />
</LinearLayout>
Try this, Have you tried this one?. Add windowSoftInputMode attribute in particular activity
android:windowSoftInputMode="adjustPan"
In your xml. add android:layout_alinParentTop="true" in your top relativelayout
<RelativeLayout
android:id="#+id/topLay"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/jam_alert_topbar"
android:layout_alinParentTop="true"
>
</RelativeLayout>
// try this
<LinearLayout 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"
android:background="#drawable/bg"
tools:context=".MainActivity" >
<LinearLayout
android:id="#+id/topLay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="#drawable/jam_alert_topbar">
</LinearLayout>
<LinearLayout
android:id="#+id/midLay"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical"
android:layout_margin="10dp" >
<fragment
android:id="#+id/mapView"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
class="com.google.android.gms.maps.SupportMapFragment" />
<EditText
android:id="#+id/descr"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="#color/white"
android:gravity="top|left"
android:hint="Description"
android:maxLines="4"
android:minLines="4" >
</EditText>
</LinearLayout>
<LinearLayout
android:id="#+id/botLay"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center" >
<Button
android:id="#+id/btReport"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/jam_tab_n"
android:onClick="btReport" />
<Button
android:id="#+id/btMap"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/map_tab_h"
android:onClick="btMap" />
<Button
android:id="#+id/btHome"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/report_tab_n"
android:onClick="btHome" />
<Button
android:id="#+id/btSetting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/settings_tab_n"
android:onClick="btSetting" />
</LinearLayout>
</LinearLayout>
I am new android development. Below i attach my layout file.
In my layout i have one ListView and one EditText with ImageButton. When i insert task in EditText and press the ImageButton that task will be added in ListView one by one.
My problem is suppose i add more than 4 task means the EditText with ImageButton view is not visible because the list items take that place please give solution thanks...
Layout:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ListView
android:id="#+id/frontpagetasklistid"
android:layout_width="fill_parent"
android:layout_height="375dp" >
</ListView>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
>
<EditText
android:id="#+id/edittextidAddTodayTask"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#drawable/edittextselector"
android:hint="Add Today Task"/>
<ImageButton
android:id="#+id/imagebuttonidAddTodayTask"
android:layout_width="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:src="#drawable/addtask" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
try this:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:id="#+id/button_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
>
<EditText
android:id="#+id/edittextidAddTodayTask"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#drawable/edittextselector"
android:hint="Add Today Task"/>
<ImageButton
android:id="#+id/imagebuttonidAddTodayTask"
android:layout_width="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:src="#drawable/addtask" />
</RelativeLayout>
<ListView
android:id="#+id/frontpagetasklistid"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="#+id/button_layout">
</ListView>
</RelativeLayout>
or
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ListView
android:id="#+id/frontpagetasklistid"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_above="#+id/button_layout">
</ListView>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
>
<EditText
android:id="#+id/edittextidAddTodayTask"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#drawable/edittextselector"
android:hint="Add Today Task"/>
<ImageButton
android:id="#+id/imagebuttonidAddTodayTask"
android:layout_width="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:src="#drawable/addtask" />
</RelativeLayout>
</LinearLayout>
i am guessing that your edittext and imagebutton are below your listview.. In that case you can add this views in listview's footer.. you can google to find how to add views in listview footer
here is a good example:
Align Button and EditText on Relative Layout
Hope it helps you!!
I have not run the below solution , But you can achieve it by using layout_weightSum and layout_weight property.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weigthSum="1">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="0.9">
<ListView
android:id="#+id/frontpagetasklistid"
android:layout_width="fill_parent"
android:layout_height="375dp" >
</ListView>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="0.1">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
>
<EditText
android:id="#+id/edittextidAddTodayTask"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#drawable/edittextselector"
android:hint="Add Today Task"/>
<ImageButton
android:id="#+id/imagebuttonidAddTodayTask"
android:layout_width="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:src="#drawable/addtask" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
I would need to try it, to proof me right, but it should work to put the ListView into a ScrollView with fixed height.
Edited:
Try to add your editText and ImageButton like footer:
<?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" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_above="#+id/lay1">
<ListView
android:id="#+id/frontpagetasklistid"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</ListView>
</RelativeLayout>
<RelativeLayout
android:id="#+id/lay1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
>
<ImageButton
android:id="#+id/imagebuttonidAddTodayTask"
android:layout_width="wrap_content"
android:layout_alignParentRight="true"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:src="#drawable/addtask"
/>
<EditText
android:id="#+id/edittextidAddTodayTask"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:ems="10"
android:background="#drawable/edittextselector"
android:hint="Add Today Task" />
</RelativeLayout>
This will might help you....