Showing a second TextView layout in Android - android

I am trying create a layout. There are several inner layouts that should like like this:
http://imageshack.us/photo/my-images/835/69560035.png/
So there is a main LinearLayout and several layouts inside like the one below.
<LinearLayout android:id="#+id/LinearLayout02"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal">
<ImageView android:id="#+id/ImageView01"
android:layout_width="30px"
android:layout_height="30px"
android:scaleType="fitXY"
android:background="#drawable/gy1"
android:layout_gravity="center_vertical">
</ImageView>
<LinearLayout android:id="#+id/LinearLayout04"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_gravity="center_vertical">
<TextView android:id="#+id/TextView01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="15px"
android:textStyle="bold"
android:textColor="#222222"
android:paddingLeft="3px">
</TextView>
<TextView android:id="#+id/TextView02"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#222222"
android:paddingBottom="5px"
android:paddingLeft="3px"
android:background="#D8D8D8"
/>
</LinearLayout>
</LinearLayout>
The second TextView is not shown, and I cannot find out what is wrong with the code. How can I fix this problem?

Or try this:
<LinearLayout
android:id="#+id/LinearLayout02"
android:layout_width="match_parent"
android:layout_height="30px"
android:layout_alignParentTop = "true"
android:orientation="horizontal">
<RelativeLayout
android:id="#+id/RelativeLayout01"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_gravity="left"
android:gravity="left">
<ImageView
android:id="#+id/ImageView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:gravity="left"
android:src="#drawable/gy1"
android:background="#null"
android:width="30px"
android:cropToPadding="true"
android:adjustViewBounds="true">
</ImageView>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_toRightOf="#+id/RelativeLayout01">
<TextView
android:id="#+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15px"
android:textStyle="bold"
android:textColor="#222222"
android:paddingLeft="3px">
</TextView>
<TextView
android:id="#+id/TextView02"
android:layout_below="#+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#222222"
android:paddingBottom="5px"
android:paddingLeft="3px"
android:background="#D8D8D8" >
</TextView>
</RelativeLayout>
</LinearLayout>

Use the following.
<LinearLayout android:id="#+id/LinearLayout02"
android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal">
<ImageView android:id="#+id/ImageView01"
android:layout_width="30px" android:layout_height="30px"
android:scaleType="fitXY" android:background="#drawable/gy1"
android:layout_gravity="center_vertical">
</ImageView>
<LinearLayout android:id="#+id/LinearLayout04"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:gravity="center_vertical">
<LinearLayout android:id="#+id/LinearLayout04"
android:layout_width="fill_parent" android:layout_height="wrap_content">
<TextView android:id="#+id/TextView01" android:layout_width="fill_parent"
android:textSize="15px" android:textStyle="bold" android:textColor="#222222"
android:paddingLeft="3px" android:layout_alignParentTop="true"
android:text="Hello" android:layout_height="fill_parent">
</TextView>
</LinearLayout>
<LinearLayout android:id="#+id/LinearLayout04"
android:layout_width="fill_parent" android:layout_height="wrap_content">
<TextView android:id="#+id/TextView02" android:layout_width="fill_parent"
android:textColor="#222222" android:paddingBottom="5px"
android:paddingLeft="3px" android:background="#D8D8D8"
android:layout_below="#+id/TextView01" android:text="Hello 2222"
android:layout_height="fill_parent" />
</LinearLayout>
</LinearLayout>
</LinearLayout>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:padding="6dip">
<ImageView
android:id="#+id/icon"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_marginRight="6dip"
android:src="#drawable/icon" />
<TextView
android:id="#+id/secondLine"
android:layout_width="fill_parent"
android:layout_height="26dip"
android:layout_toRightOf="#id/icon"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:singleLine="true"
android:ellipsize="marquee"
android:text="Simple application that shows how to use RelativeLayout" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#id/icon"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_above="#id/secondLine"
android:layout_alignWithParentIfMissing="true"
android:gravity="center_vertical"
android:text="My Application" />
</RelativeLayout>
This technique in Android Layout Tricks #1 may solve your problem.

Related

How can I make the TextView controls which contain characters "A" have the same width with text align left and control align right?

I hope the TextView controls which contain characters "A" have the same width with text align left and control align right , so I have set TextView controls which contain characters "A" with max width="150dp",
and I have set android:gravity="left" and android:layout_gravity="right"
I think I can get the result AA.png, but in fact the result is BB.png
I hope (AA.png)
Current (BB.png)
<?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:background="#drawable/border_ui"
android:orientation="vertical" >
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="#+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adSize="SMART_BANNER"
android:layout_alignParentTop="true"
ads:adUnitId="#string/ad_unit_id" />
<LinearLayout
android:layout_above="#+id/linearLayout1"
android:layout_below="#+id/adView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
>
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:layout_gravity="right"
android:layout_weight="0.5">
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="A"
android:id="#+id/textView2"/>
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="AAA"
android:id="#+id/textView4"/>
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="AAAAA"
android:id="#+id/textView5"/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="B"
android:id="#+id/textView3"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="BBB"
android:id="#+id/textView6"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="BBBB"
android:id="#+id/textView7"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
android:weightSum="4" >
<Button
android:id="#+id/btnReturn"
style="#style/myTextMedium"
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:text="#string/BtnReturn" />
</LinearLayout>
</RelativeLayout>
You can accomplish that by adding an extra LinearLayout and removing the 150dp limitation:
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="#+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adSize="SMART_BANNER"
android:layout_alignParentTop="true"
ads:adUnitId="#string/ad_unit_id" />
<LinearLayout
android:layout_above="#+id/linearLayout1"
android:layout_below="#+id/adView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
>
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:layout_weight="0.5">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="right">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="A"
android:id="#+id/textView2"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="AAA"
android:id="#+id/textView4"/>
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="AAAAA"
android:id="#+id/textView5"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="B"
android:id="#+id/textView3"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="BBB"
android:id="#+id/textView6"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="BBBB"
android:id="#+id/textView7"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
android:weightSum="4" >
<Button
android:id="#+id/btnReturn"
style="#style/myTextMedium"
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:text="#string/BtnReturn" />
</LinearLayout>
i guess you will use
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:layout_gravity="right"
android:layout_weight="0.5"
android:layoutMarginLeft="20dp">
android:layoutMarginLeft="20dp"

Android Title + Button in titlebar not coming properly aligned

I am trying to add title + button in titlebar in Android. But somehow i am not happy with the kind of result i am getting. May be something wrong with code. Has anyone tried this earlier ? My .xml is below
code.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="40dip"
android:background="#484848"
android:orientation="horizontal">
<TextView
android:id="#+id/windowtitle"
android:layout_width="match_parent"
android:layout_marginTop="2dip"
android:layout_height="wrap_content"
android:text="Support"
android:gravity="center_horizontal"
android:textSize="30sp" ></TextView>
<Button
android:id="#+id/syncbutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="3dip"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:gravity="left"
android:text="Sync" />
</RelativeLayout>
</RelativeLayout>
Please mention exact issue you are facing, I assume the alignment of the two views is not proper is the issue.
You can give the relative position of the button with respect to the text view to the button xml,
android:layout_toRightOf="#+id/windowtitle"
Also, add the alignment to the textview
Replace your XML with below code..
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#484848"
android:orientation="horizontal">
<TextView
android:id="#+id/windowtitle"
android:layout_width="fill_parent"
android:layout_centerInParent="true"
android:layout_height="wrap_content"
android:text="Support"
android:gravity="center_horizontal|center_vertical"
android:textSize="30sp" ></TextView>
<Button
android:id="#+id/syncbutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginTop="3dip"
android:layout_alignParentRight="true"
android:text="Sync" />
</RelativeLayout>
</RelativeLayout>
Hope this work.....
Try this..
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="40dip"
android:background="#484848">
<TextView
android:id="#+id/windowtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Support"
android:layout_centerHorizontal="true"
android:textSize="30sp" ></TextView>
<Button
android:id="#+id/syncbutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:text="Sync" />
</RelativeLayout>
</RelativeLayout>
Here is my screen
Remove android:gravity="center_horizontal" from windowtitle Textview and add android:layout_centerInParent="true" even change width to wrap_content.
and add android:layout_centerVertical="true" to syncbutton button and there is no need of android:layout_alignParentTop="true"
It all centered your views.
check below xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="40dip"
android:background="#484848"
android:orientation="horizontal" >
<TextView
android:id="#+id/windowtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginTop="2dip"
android:text="Support"
android:textSize="30sp" >
</TextView>
<Button
android:id="#+id/syncbutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_gravity="center"
android:layout_marginTop="3dip"
android:gravity="left"
android:text="Sync" />
</RelativeLayout>
</RelativeLayout>
Use this
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="50dip"
android:background="#484848" >
<TextView
android:id="#+id/windowtitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="Support"
android:textSize="30sp" >
</TextView>
<Button
android:id="#+id/syncbutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:text="Sync" />
</RelativeLayout>
Use the following Code this might fullfill your requirement:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#484848"
android:orientation="horizontal">
<TextView
android:id="#+id/windowtitle"
android:layout_width="match_parent"
android:layout_centerVertical="true"
android:layout_height="wrap_content"
android:text="Support"
android:gravity="center_horizontal"
android:textSize="30sp" ></TextView>
<Button
android:id="#+id/syncbutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="Sync" />
</RelativeLayout>
</RelativeLayout>
use this
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="40dip"
android:background="#484848"
android:orientation="horizontal">
<TextView
android:id="#+id/windowtitle"
android:layout_width="wrap_content"
android:layout_marginTop="2dip"
android:layout_height="wrap_content"
android:text="Support"
android:gravity="center_horizontal"
android:textSize="30sp" ></TextView>
<Button
android:id="#+id/syncbutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:text="Sync" />
</RelativeLayout>

ListView problem

I have an image of some restaurant and under that some info of that restaurant. Under all of that i have some listView with some menu (what is on discount)... My problem is this: Before listView i have an textView with a description of that restaurant. It can be different sizes for different restaurants, and because of that sometimes my listView isn't showing on screen. I tried to put ScrollView, but it was bad idea... What can I do??? ANy sugestion??? Here is my code:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:weightSum="100"
android:keepScreenOn="true">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="50"
android:id="#+id/linearLayoutOne1">
<ImageView android:layout_width="0dip"
android:layout_height="wrap_content"
android:src="#drawable/marker_a"
android:id="#+id/imageView1"
android:layout_weight="1"
android:scaleType="fitStart"
android:layout_gravity="center"
>
</ImageView>
</LinearLayout>
<ScrollView
android:id="#+id/widgetOne"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="50"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView android:text="Ime restorana"
android:textSize="20sp"
android:id="#+id/textViewImeRestorana"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="center"
android:background="#5E5E5E">
</TextView>
<TextView android:text=""
android:id="#+id/textViewAdresa"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:layout_weight="1">
</TextView>
<TextView android:text="#string/daljina"
android:id="#+id/textViewDaljina"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:layout_weight="1">
</TextView>
<TextView
android:text=""
android:id="#+id/textViewNista"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:layout_weight="1">
</TextView>
<TextView android:text="#string/radno_vreme_"
android:id="#+id/textViewRadnoVreme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:layout_weight="1">
</TextView>
<TextView android:text="#string/pon_nedelja"
android:id="#+id/textViewPonSub"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:layout_weight="1">
</TextView>
<TextView android:text="Nedelja"
android:id="#+id/textViewNedelja"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:layout_weight="1">
</TextView>
<TextView android:text="#string/pozovite_nas_"
android:id="#+id/textViewPozovite"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:layout_weight="1">
</TextView>
<Button android:text="Pozovi"
android:id="#+id/buttonPozovi"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="12sp"
android:layout_weight="1">
</Button>
<TextView android:text="Opis"
android:id="#+id/textViewOpis"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textColor="#5E5E5E"
android:background="#drawable/border">
</TextView>
<TextView android:text="#string/specijalna_ponuda"
android:id="#+id/textViewSpecijalnaPonuda"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="18sp">
</TextView>
<TextView android:text=""
android:id="#+id/textViewPonudeNema"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
android:textSize="14sp">
</TextView>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ListView
android:id="#+id/listViewPonuda"
android:layout_width="fill_parent"
android:smoothScrollbar="true"
android:visibility="visible"
android:layout_height="70dip"
android:textSize="14sp">
</ListView>
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
Placing ListView or ScrollView on another List/ScrollView doesn't work properly.
You can use ListView#addHeaderView(View view) to add the description of the restaurant. This behaves as one more row at the top of the list which doesn't need to be similar to the other rows defined in adapter.
In you xml file you used the layourt height as fill_parent in the inner layout.So that it behaves like that.
try this code
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="Vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:weightSum="100"
android:keepScreenOn="true">
<ImageView
android:layout_width="0dip"
android:layout_height="wrap_content"
android:src="#drawable/marker_a"
android:id="#+id/imageView1"
android:layout_weight="1"
android:scaleType="fitStart"
android:layout_gravity="center"
/>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView android:text="Ime restorana"
android:textSize="20sp"
android:id="#+id/textViewImeRestorana"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="center"
android:background="#5E5E5E">
</TextView>
<TextView android:text=""
android:id="#+id/textViewAdresa"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:layout_weight="1">
</TextView>
<TextView android:text="#string/daljina"
android:id="#+id/textViewDaljina"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:layout_weight="1">
</TextView>
<TextView
android:text=""
android:id="#+id/textViewNista"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:layout_weight="1">
</TextView>
<TextView android:text="#string/radno_vreme_"
android:id="#+id/textViewRadnoVreme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:layout_weight="1">
</TextView>
<TextView android:text="#string/pon_nedelja"
android:id="#+id/textViewPonSub"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:layout_weight="1">
</TextView>
<TextView android:text="Nedelja"
android:id="#+id/textViewNedelja"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:layout_weight="1">
</TextView>
<TextView android:text="#string/pozovite_nas_"
android:id="#+id/textViewPozovite"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:layout_weight="1">
</TextView>
<Button android:text="Pozovi"
android:id="#+id/buttonPozovi"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="12sp"
android:layout_weight="1">
</Button>
<TextView android:text="Opis"
android:id="#+id/textViewOpis"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textColor="#5E5E5E"
android:background="#drawable/border">
</TextView>
<TextView android:text="#string/specijalna_ponuda"
android:id="#+id/textViewSpecijalnaPonuda"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="18sp">
</TextView>
<TextView android:text=""
android:id="#+id/textViewPonudeNema"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
android:textSize="14sp">
</TextView>
<ListView
android:id="#+id/listViewPonuda"
android:layout_width="fill_parent"
android:smoothScrollbar="true"
android:visibility="visible"
android:layout_height="70dip"
android:textSize="14sp"/>
</LinearLayout>
</LinearLayout>

Can not see Button at bottom

in Xml file i can not see button at bottom my code is here please help me
<?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:background="#drawable/background">
<RelativeLayout android:layout_width="fill_parent"
android:background="#drawable/navigationbar" android:layout_below="#+id/top"
android:id="#+id/toptext" android:layout_height="50dip">
<Button android:layout_width="wrap_content" android:background="#drawable/back"
android:textStyle="bold" android:layout_height="wrap_content"
android:paddingLeft="10dip" android:layout_margin="10dip" android:id="#+id/back"
android:layout_alignParentLeft="true"></Button>
<TextView android:layout_width="wrap_content" android:text="#string/source_of_stress"
android:textSize="20dip" android:layout_marginLeft="100dip"
android:layout_marginTop="8dip" android:layout_height="wrap_content"
android:textColor="#FFFFFF" android:textStyle="bold" />
</RelativeLayout>
<RelativeLayout android:orientation="horizontal"
android:id="#+id/date" android:layout_below="#+id/toptext"
android:gravity="center" android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button android:id="#+id/previous" android:background="#drawable/left_arrow"
android:visibility="gone" android:layout_marginTop="15dip"
android:layout_marginLeft="10dip" android:layout_alignParentLeft="true"
android:layout_width="20dip" android:layout_height="23dip"
android:textColor="#FFFFFFFF" />
<RelativeLayout android:layout_width="fill_parent"
android:background="#drawable/datebar"
android:layout_centerHorizontal="true" android:layout_height="wrap_content"
android:paddingLeft="10dip" android:paddingRight="10dip">
<TextView android:id="#+id/currentDate" android:textSize="19sp"
android:layout_centerHorizontal="true" android:layout_marginTop="10dip"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:textColor="#2972cc" android:text="Monday" android:textStyle="bold" />
<Button android:id="#+id/next" android:background="#drawable/right_arrow"
android:visibility="gone" android:layout_marginTop="15dip"
android:layout_marginRight="10dip" android:layout_alignParentRight="true"
android:layout_width="20dip" android:layout_height="23dip"
android:textColor="#FFFFFFFF" />
</RelativeLayout>
</RelativeLayout>
<!--
<TextView android:layout_width="wrap_content"
android:visibility="gone" android:textSize="11sp"
android:layout_marginLeft="8dip" android:layout_below="#+id/date"
android:id="#+id/all_sos_text" android:layout_marginTop="5dip"
android:layout_height="wrap_content"></TextView> <ScrollView
android:id="#+id/list_scroll" android:layout_marginBottom="55dip"
android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_below="#+id/date"
android:layout_marginTop="5dip" android:fadingEdge="none"
android:scrollbars="none">
-->
<ScrollView android:id="#+id/sos_scroll"
android:layout_marginBottom="82dip" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_below="#+id/date"
android:layout_marginTop="5dip" android:fadingEdge="none"
android:scrollbars="none">
<LinearLayout android:layout_width="fill_parent"
android:id="#+id/sos_lin" android:layout_height="wrap_content"
android:orientation="vertical">
<ListView android:paddingLeft="1dip" android:scrollbars="none"
android:cacheColorHint="#00000000" android:focusable="true"
android:id="#+id/list" android:dividerHeight="2dip"
android:footerDividersEnabled="false" android:headerDividersEnabled="false"
android:layout_marginRight="12dip" android:listSelector="#android:color/transparent"
android:background="#drawable/newshape_list"
android:layout_marginLeft="12dip" android:paddingRight="1dip"
android:layout_height="230dip" android:layout_width="fill_parent"
android:fadingEdge="none" android:divider="#A9ABAD"></ListView>
<RelativeLayout android:layout_width="wrap_content"
android:layout_marginLeft="10dip" android:layout_marginBottom="50dip"
android:layout_marginRight="10dip" android:layout_height="wrap_content"
android:layout_below="#+id/list">
<TableLayout android:layout_width="wrap_content"
android:id="#+id/add_table" android:layout_centerHorizontal="true"
android:background="#drawable/listback" android:layout_height="wrap_content"
android:stretchColumns="1">
<TableRow android:id="#+id/add_data">
<ImageView android:layout_width="wrap_content"
android:src="#drawable/addbuttonimage" android:id="#+id/que1"
android:layout_height="wrap_content"></ImageView>
<TextView android:text="Add New Stress..."
android:layout_width="wrap_content" android:textStyle="bold"
android:textColor="#000000" android:layout_marginLeft="5dip"
android:textSize="15sp" android:layout_height="wrap_content"
android:padding="3dip" />
</TableRow>
</TableLayout>
</RelativeLayout>
</LinearLayout>
</ScrollView>
<RelativeLayout android:layout_gravity="center_horizontal"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:layout_below="#+id/sos_scroll" android:id="#+id/donerel"
android:layout_marginTop="5dip" android:layout_centerHorizontal="true">
<Button android:textColor="#FFFFFF" android:text="Save"
android:layout_width="wrap_content" android:textStyle="bold"
android:background="#drawable/savebutton" android:layout_height="wrap_content"
android:id="#+id/done"></Button>
</RelativeLayout>
The reason that the layout is not showing is layout_marginBottom="82dip" on the ScrollView
So changing:
<ScrollView android:id="#+id/sos_scroll"
android:layout_marginBottom="82dip" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_below="#+id/date"
android:layout_marginTop="5dip" android:fadingEdge="none"
android:scrollbars="none">
to for example:
<ScrollView android:id="#+id/sos_scroll"
android:layout_marginBottom="1dip" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_below="#+id/date"
android:layout_marginTop="5dip" android:fadingEdge="none"
android:scrollbars="none">
should help.

layout problem in android

I am creating fixed header and fixed footer for RelativeLayout. In the center part I am adding array of WebView when it come ScrollView it hide header and footer.
How can I avoid that?
This is my layout file:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/mainrelativelayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#color/white"
android:id="#+id/mainlinear2"
android:layout_alignParentTop="true"
android:orientation="vertical">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="15dip"
android:orientation="horizontal"
android:id="#+id/linear5">
<TextView android:text=" "
android:id="#+id/txtwebservice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12dip"
android:textColor="#color/gray2"></TextView>
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:id="#+id/linear1"
android:layout_height="6dip"
android:orientation="horizontal">
<ImageView android:id="#+id/ImageView08"
android:layout_gravity="center"
android:background="#drawable/line"
android:layout_width="fill_parent"
android:layout_height="wrap_content"></ImageView>
</LinearLayout>
<LinearLayout mlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:id="#+id/linear1"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView android:paddingRight="75dip"
android:paddingLeft="20dip"
android:text="Index"
android:id="#+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textStyle="bold"></TextView>
<TextView android:paddingRight="60dip"
android:text="Last"
android:id="#+id/TextView02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textStyle="bold"></TextView>
<TextView android:text="Change"
android:id="#+id/TextView03"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textStyle="bold"></TextView>
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:id="#+id/linear1"
android:layout_height="6dip"
android:orientation="horizontal">
<ImageView
android:id="#+id/ImageView08"
android:layout_gravity="center"
android:background="#drawable/line"
android:layout_width="fill_parent"
android:layout_height="wrap_content"></ImageView>
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/linear2"
android:orientation="horizontal">
<ImageView android:id="#+id/ImageView05"
android:paddingTop="5dip"
android:layout_gravity="center"
android:background="#drawable/down"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></ImageView>
<TextView
android:paddingRight="30dip"
android:paddingLeft="10dip"
android:text=""
android:id="#+id/txtindex0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textSize="12dip"></TextView>
<TextView
android:paddingRight="55dip"
android:text=""
android:id="#+id/txtlast0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textSize="12dip"></TextView>
<TextView android:text=""
android:id="#+id/txtchange0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12dip"
android:textColor="#color/red1"></TextView>
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/linear3"
android:orientation="horizontal">
<ImageView android:id="#+id/ImageView02"
android:layout_gravity="center"
android:background="#drawable/up"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></ImageView>
<TextView
android:paddingRight="46dip"
android:paddingLeft="10dip"
android:text=""
android:id="#+id/txtindex1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textSize="12dip"></TextView>
<TextView android:paddingRight="64dip"
android:text=""
android:id="#+id/txtlast1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textSize="12dip"></TextView>
<TextView android:text=""
android:id="#+id/txtchange1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12dip"
android:textColor="#color/green1"></TextView>
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/linear4"
android:orientation="horizontal">
<ImageView android:id="#+id/ImageView03"
android:layout_gravity="center"
android:background="#drawable/up"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></ImageView>
<TextView android:paddingRight="69dip"
android:paddingLeft="10dip"
android:text=""
android:id="#+id/txtindex2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textSize="12dip"></TextView>
<TextView android:paddingRight="67dip"
android:text=""
android:id="#+id/txtlast2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textSize="12dip"></TextView>
<TextView android:text=""
android:id="#+id/txtchange2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12dip"
android:textColor="#color/green1"></TextView>
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/linear4"
android:orientation="horizontal">
<ImageView android:id="#+id/ImageView04"
android:layout_gravity="center"
android:background="#drawable/up"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></ImageView>
<TextView android:paddingRight="61dip"
android:paddingLeft="10dip"
android:text=""
android:id="#+id/txtindex3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textSize="12dip"></TextView>
<TextView android:paddingRight="65dip"
android:text=""
android:id="#+id/txtlast3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/black"
android:textSize="12dip"></TextView>
<TextView android:text=""
android:id="#+id/txtchange3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12dip"
android:textColor="#color/green1"></TextView>
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:id="#+id/linear1"
android:layout_height="4dip"
android:orientation="horizontal">
<ImageView
android:id="#+id/ImageView08"
android:layout_gravity="center"
android:background="#drawable/line"
android:layout_width="fill_parent"
android:layout_height="wrap_content"></ImageView>
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="15dip"
android:id="#+id/linear5"
android:orientation="horizontal">
<TextView android:text="Market data delayed at least 15 minutes "
android:id="#+id/TextView16"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12dip"
android:textColor="#color/gray2"></TextView>
</LinearLayout>
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/linear8"
android:background="#color/white"
android:layout_alignParentBottom="true">
<ImageView android:id="#+id/ImageView15"
android:src="#drawable/quest_i"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></ImageView>
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="200dip"
android:background="#color/white"
android:id="#+id/mainlinear3"
android:layout_above="#+id/linear8"
android:layout_below="#+id/mainlinear2"
android:layout_weight="1">
</LinearLayout>
</RelativeLayout>
<!--</ScrollView>-->
why you are making it a single view....
Attach two imageView header and footer to the scrollview .
|ImageView| |/ImageView|
|ScrollView| |/ScrollView|
|ImageView| |/ImageView|

Categories

Resources