This is what I actually have as a result:
As you can see value to right of Current HP is moved to right instead to stay close to "Current HP" textview like the rest of values. Why is that so? This is my code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:background="#color/semiTrans"
android:layout_height="match_parent">
<RelativeLayout
android:id="#+id/llHeader"
android:layout_margin="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#id/text"
android:layout_marginRight="5dp"
app:srcCompat="#android:drawable/ic_dialog_info" />
<TextView
android:id="#+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:gravity="center_vertical|center_horizontal"
android:text="CONTINUE INFO"
android:textColor="#000"
android:textSize="25sp" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/rl2"
android:layout_marginHorizontal="10dp"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/llHeader"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true">
<TextView
android:id="#+id/currentHp"
android:textStyle="bold"
android:layout_width="168dp"
android:layout_height="wrap_content"
android:text="Current HP: "
android:textSize="18sp"/>
<TextView
android:id="#+id/nextHp"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/currentHp"
android:text="Next +10HP: "
android:textSize="18sp"/>
<TextView
android:id="#+id/fullHp"
android:textStyle="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/nextHp"
android:text="HP fully recovered: "
android:textSize="18sp"/>
<TextView
android:id="#+id/currentHpValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toEndOf="#+id/currentHp"
android:layout_toRightOf="#+id/currentHp"
android:text="a"
android:textSize="18sp"/>
<TextView
android:id="#+id/nextHpValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/currentHp"
android:layout_toEndOf="#+id/nextHp"
android:layout_toRightOf="#+id/nextHp"
android:text="a"
android:textSize="18sp"/>
<TextView
android:id="#+id/fullHpValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/fullHp"
android:layout_alignBottom="#+id/fullHp"
android:layout_toEndOf="#+id/fullHp"
android:layout_toRightOf="#+id/fullHp"
android:text="a"
android:textSize="18sp"/>
<TextView
android:id="#+id/tvAdditionalInfo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_below="#id/fullHp"
android:textSize="18sp"
android:layout_centerHorizontal="true"
android:text="Additional info"/>
</RelativeLayout>
<Button
android:id="#+id/dialogButtonOK"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/rl2"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_marginHorizontal="10dp"
android:layout_marginBottom="10dp"
android:background="#drawable/button"
android:text=" Ok " />
</RelativeLayout>
I was trying to solve this by setting padding and margin to 0 but it did not work. I do not know what else Ishould added.
I found a solution. I need to set currentHp textview width to wrap content.
Your current Hp has a width 168 dp.
For this reason it is taking that place and after that place your a text is showing.
So you have make the width of current Hp to wrap-content . Then the text a will stay like others.
You can check this code to solve the issue
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:background="#color/semiTrans"
android:layout_height="match_parent">
<RelativeLayout
android:id="#+id/llHeader"
android:layout_margin="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#id/text"
android:layout_marginRight="5dp"
app:srcCompat="#android:drawable/ic_dialog_info" />
<TextView
android:id="#+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:gravity="center_vertical|center_horizontal"
android:text="CONTINUE INFO"
android:textColor="#000"
android:textSize="25sp" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/rl2"
android:layout_marginHorizontal="10dp"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/llHeader"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true">
<TextView
android:id="#+id/currentHp"
android:textStyle="bold"
android:layout_width="168dp"
android:layout_height="wrap_content"
android:text="Current HP: "
android:textSize="18sp"/>
<TextView
android:id="#+id/nextHp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/currentHp"
android:layout_marginEnd="62dp"
android:layout_toStartOf="#+id/currentHpValue"
android:text="Next +10HP: "
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="#+id/fullHp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/nextHp"
android:layout_marginEnd="10dp"
android:layout_toStartOf="#+id/currentHpValue"
android:text="HP fully recovered: "
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="#+id/currentHpValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toEndOf="#+id/currentHp"
android:layout_toRightOf="#+id/currentHp"
android:text="a"
android:textSize="18sp"/>
<TextView
android:id="#+id/nextHpValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/currentHp"
android:layout_toEndOf="#+id/nextHp"
android:layout_toRightOf="#+id/nextHp"
android:text="a"
android:textSize="18sp"/>
<TextView
android:id="#+id/fullHpValue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/fullHp"
android:layout_alignBottom="#+id/fullHp"
android:layout_toEndOf="#+id/fullHp"
android:layout_toRightOf="#+id/fullHp"
android:text="a"
android:textSize="18sp"/>
<TextView
android:id="#+id/tvAdditionalInfo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_below="#id/fullHp"
android:textSize="18sp"
android:layout_centerHorizontal="true"
android:text="Additional info"/>
</RelativeLayout>
<Button
android:id="#+id/dialogButtonOK"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/rl2"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_marginHorizontal="10dp"
android:layout_marginBottom="10dp"
android:background="#drawable/button"
android:text=" Ok " />
</RelativeLayout>
Related
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_height="match_parent">
<HorizontalScrollView
android:id="#+id/hsv"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:fillViewport="true"
android:measureAllChildren="false"
android:scrollbars="none" >
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal">
<TableRow
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="An"
android:id="#+id/textView1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Codificare
Disciplina"
android:layout_marginLeft="10dp"
android:id="#+id/TexView2"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Denumire"
android:layout_marginLeft="10dp"
android:id="#+id/TexView3" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Numar ore
Curs"
android:layout_marginLeft="10dp"
android:id="#+id/TexView4" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Numar ore
Seminar"
android:layout_marginLeft="10dp"
android:id="#+id/textView5" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Numar ore
Laborator"
android:layout_marginLeft="10dp"
android:id="#+id/TexView6"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Numar ore
Proiect"
android:layout_marginLeft="10dp"
android:id="#+id/TexView7" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Numar Credite"
android:layout_marginLeft="10dp"
android:id="#+id/TexView8" />
</TableRow>
</TableLayout>
</LinearLayout>
</HorizontalScrollView>
</RelativeLayout>
I can't add multiple rows in this table because i got errors like SrollView can hold only one parent at once and when i try to solve it the row goes vertically in column. Please help me.
I just tried all the solutions and i can't make it works. I don't know why i tried to solve this with solution find on stackoverflow and sites like this but i can't.
You are setting height = 0dp in your rows. Change this
android:layout_height="0dp"
to this:
android:layout_height="wrap_content"
Tested with 2 rows, all worked as aspected for me:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_height="match_parent">
<HorizontalScrollView
android:id="#+id/hsv"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:fillViewport="true"
android:measureAllChildren="false"
android:scrollbars="none" >
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal">
<TableRow
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="An"
android:id="#+id/textView1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Codificare
Disciplina"
android:layout_marginLeft="10dp"
android:id="#+id/TexView2"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Denumire"
android:layout_marginLeft="10dp"
android:id="#+id/TexView3" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Numar ore
Curs"
android:layout_marginLeft="10dp"
android:id="#+id/TexView4" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Numar ore
Seminar"
android:layout_marginLeft="10dp"
android:id="#+id/textView5" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Numar ore
Laborator"
android:layout_marginLeft="10dp"
android:id="#+id/TexView6"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Numar ore
Proiect"
android:layout_marginLeft="10dp"
android:id="#+id/TexView7" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Numar Credite"
android:layout_marginLeft="10dp"
android:id="#+id/TexView8" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_margin="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="An"
android:id="#+id/textView21" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Codificare
Disciplina"
android:layout_marginLeft="10dp"
android:id="#+id/TexView22"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Denumire"
android:layout_marginLeft="10dp"
android:id="#+id/TexView23" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Numar ore
Curs"
android:layout_marginLeft="10dp"
android:id="#+id/TexView24" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Numar ore
Seminar"
android:layout_marginLeft="10dp"
android:id="#+id/textView25" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Numar ore
Laborator"
android:layout_marginLeft="10dp"
android:id="#+id/TexView26"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Numar ore
Proiect"
android:layout_marginLeft="10dp"
android:id="#+id/TexView27" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Numar Credite"
android:layout_marginLeft="10dp"
android:id="#+id/TexView28" />
</TableRow>
</TableLayout>
</LinearLayout>
</HorizontalScrollView>
</RelativeLayout>
What's your problem?
May be you should try this :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_height="match_parent">
<HorizontalScrollView
android:id="#+id/hsv"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:fillViewport="true"
android:measureAllChildren="false"
android:scrollbars="none" >
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="android:attr/textAppearanceLarge"
android:text="An"
android:id="#+id/textView1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="android:attr/textAppearanceLarge"
android:text="CodificareDisciplina"
android:layout_marginLeft="10dp"
android:id="#+id/TexView2"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="android:attr/textAppearanceLarge"
android:text="Denumire"
android:layout_marginLeft="10dp"
android:id="#+id/TexView3" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="android:attr/textAppearanceLarge"
android:text="Numar oreCurs"
android:layout_marginLeft="10dp"
android:id="#+id/TexView4" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="android:attr/textAppearanceLarge"
android:text="Numar oreSeminar"
android:layout_marginLeft="10dp"
android:id="#+id/textView5" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="android:attr/textAppearanceLarge"
android:text="Numar oreLaborator"
android:layout_marginLeft="10dp"
android:id="#+id/TexView6"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="android:attr/textAppearanceLarge"
android:text="Numar oreProiect"
android:layout_marginLeft="10dp"
android:id="#+id/TexView7" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="android:attr/textAppearanceLarge"
android:text="Numar Credite"
android:layout_marginLeft="10dp"
android:id="#+id/TexView8" />
</LinearLayout>
</HorizontalScrollView>
</RelativeLayout>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/hsv"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Caca"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_margin="10dp"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Caca"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_margin="10dp"
/>
</TableRow>
</RelativeLayout>
i add this after my code, another row appear but when i move LinearLayout and Scrollview the enhance all code my text goes on first row at the end. I tried all that you told me but doesn't work.
I have the code below and I face a problem with the image view "#+id/logo_skilfull" because it does not keep the aspect.. I think is because of the scaleType or the adjustViewBounds..
image in tablet
image in a phone (I want this)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/RelativeLayoutMain"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#FFF"
android:descendantFocusability="beforeDescendants"
android:focusableInTouchMode="true"
android:keepScreenOn="true" >
<View
android:id="#+id/view"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_alignParentTop="true" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/view2"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/view"
android:layout_centerHorizontal="true"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:background="#drawable/registration_background"
android:orientation="vertical"
android:padding="25dp" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/member_login_tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="15dp"
android:text="Ingresá tu DNI"
android:textSize="25dp"
android:textStyle="bold"
android:typeface="monospace" />
<EditText
android:id="#+id/username_edtext"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/member_login_tv"
android:layout_centerHorizontal="true"
android:layout_marginTop="25dp"
android:background="#drawable/register_uname"
android:gravity="center"
android:hint="Documento"
android:imeOptions="actionDone"
android:inputType="number"
android:singleLine="true"
android:textColor="#000000"
android:textSize="30dp"
android:textStyle="bold" />
<Button
android:id="#+id/login_button"
style="#style/button_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/username_edtext"
android:layout_centerHorizontal="true"
android:layout_marginTop="25dp"
android:background="#drawable/button_access"
android:text="Aceptar"
android:textColor="#ffffff" />
<ImageView
android:id="#+id/logo_skilfull"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:background="#drawable/logos"
android:scaleType="matrix"
android:layout_alignParentBottom="true" />
</RelativeLayout>
</LinearLayout>
<View
android:id="#+id/view2"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true" />
<ImageView
android:id="#+id/view_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="15dp"
android:background="#drawable/member_imview" />
</RelativeLayout>
You should read about the ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
This is a problem changing the size of the View. You need to set scaleType.
Try fitStart.
<ImageView
android:id="#+id/logo_skilfull"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:background="#drawable/logos"
android:scaleType="fitStart"
android:layout_alignParentBottom="true" />
This XML is for a ROW in a custom listview. It seems to have an Invisible FRAME, I can't seem to be able to get rid of it and make row fill parent.
I would like the end result to be nothing but Rows, and not able to see background of layer below.
Thank you for reading, XML:
<?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"
android:padding="10dp">
<RelativeLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:background="#ff515152"
android:layout_alignParentTop="true"
android:id="#+id/relativeLayout"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<TextView
android:layout_width="140dp"
android:layout_height="wrap_content"
android:text="New Text"
android:id="#+id/textView2"
android:textSize="25dp"
android:textColor="#fffff7fd"
android:gravity="center_vertical|right"
android:layout_centerVertical="true"
android:layout_toLeftOf="#+id/textView"
android:layout_toStartOf="#+id/textView" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="25dp"
android:textColor="#fffff7fd"
android:layout_gravity="center_horizontal"
android:text="AND"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:id="#+id/textView" />
<TextView
android:layout_width="140dp"
android:layout_height="wrap_content"
android:text="New Text"
android:id="#+id/group_name"
android:textSize="25dp"
android:textColor="#fffff7fd"
android:gravity="center_vertical|right"
android:layout_centerVertical="true"
android:layout_toRightOf="#+id/textView"
android:layout_toEndOf="#+id/textView" />
</RelativeLayout>
<RelativeLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ffb7bcb5"
android:layout_below="#+id/relativeLayout"
android:layout_centerHorizontal="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="#+id/textView3"
android:layout_gravity="center_horizontal"
android:layout_alignParentLeft="false"
android:layout_marginLeft="0dp"
android:layout_alignParentTop="false"
android:layout_marginTop="0dp"
android:layout_centerHorizontal="true"
android:textSize="17dp"
android:textColor="#fffff7fd" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="#+id/textView4"
android:layout_alignParentTop="true"
android:layout_toLeftOf="#+id/textView3"
android:layout_toStartOf="#+id/textView3"
android:textSize="17dp"
android:textColor="#fffff7fd" />
</RelativeLayout>
</RelativeLayout>
In my Android app.. I need my textview..( textview about contact us) so this textview has to be at the end of the page of the scroll view.. it should be above the scrollview.. I did code like this but what happening is textview is filling from the centre to the bottom..
I am giving my code below.. I used align_parentbottom ... but the text is at the centre and the rest portion is filling till the bottom with the background color..
xml
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/orange"
android:fillViewport="true"
android:orientation="vertical" >
<RelativeLayout
android:id="#+id/rLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content">"
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="18dp"
android:padding="15dip"
android:text="Current Challenge"
android:textSize="18dip" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView3"
android:layout_alignBottom="#+id/textView3"
android:layout_toRightOf="#+id/textView3"
android:text="PDNo" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView1"
android:layout_marginTop="20dp"
android:padding="15dip"
android:text="Your Current Challenge : "
android:textSize="16dip" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView3"
android:layout_marginLeft="14dp"
android:layout_marginTop="29dp"
android:text="Prediction for your Current Challenge will be displayed here..." />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView4"
android:layout_alignParentBottom="true"
android:background="#drawable/title_border"
android:padding="15dip"
android:text="Contact us :"
android:textColor="#FFFFFF"
/>
</RelativeLayout>
</ScrollView>
<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="#color/orange">
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/textView5"
android:fillViewport="true"
android:orientation="vertical" >
<RelativeLayout
android:id="#+id/rLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="18dp"
android:padding="15dip"
android:text="Current Challenge"
android:textSize="18dip" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView3"
android:layout_alignBottom="#+id/textView3"
android:layout_toRightOf="#+id/textView3"
android:text="PDNo" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView1"
android:layout_marginTop="20dp"
android:padding="15dip"
android:text="Your Current Challenge : "
android:textSize="16dip" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView3"
android:layout_marginLeft="14dp"
android:layout_marginTop="29dp"
android:text="Prediction for your Current Challenge will be displayed here..." />
</RelativeLayout>
</ScrollView>
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="#000000"
android:padding="15dip"
android:text="Contact us :"
android:textColor="#FFFFFF" />
</RelativeLayout>
remove android:layout_below="#+id/textView4" from textView5
I'm trying to add admob into my android app, but I keep having this error in eclipse:
Element type "com.admob.android.ads.AdView" must be followed by either attribute specifications,
">" or "/>".
The code is:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:myapp="http://schemas.android.com/apk/res/com.example.SampleApp"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.admob.android.ads.AdView android:id="#+id/ad"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
myapp:backgroundColor="#000000"
myapp:primaryTextColor="#FFFFFF"
myapp:secondaryTextColor="#CCCCCC"</com.admob.android.ads.AdView>
</LinearLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/RelativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#00BFFF"
android:orientation="vertical"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<TextView
android:id="#+id/txt_stupnjevi"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/txt_grad"
android:layout_below="#+id/txt_grad"
android:layout_marginTop="5dp"
android:textColor="#FFF"
android:textSize="40sp" />
<ImageView
android:id="#+id/img_glavna"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/linearLayout1"
android:layout_below="#+id/txt_stupnjevi"
android:layout_centerHorizontal="true"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:adjustViewBounds="true"
android:src="#drawable/img01d" />
<TextView
android:id="#+id/txt_grad"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/img_glavna"
android:layout_alignParentTop="true"
android:textColor="#FFF"
android:textSize="35sp" />
<ProgressBar
android:id="#+id/progressBar1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:indeterminate="true"
android:visibility="gone" />
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:baselineAligned="false"
android:weightSum="3" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical" >
<TextView
android:id="#+id/txt_dan1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:maxLength="3"
android:paddingTop="10dp"
android:textColor="#FFF"
android:textSize="20sp" />
<ImageView
android:id="#+id/img_dan1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="#drawable/img01n" />
<TextView
android:id="#+id/txt_stupnjevi1"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:paddingBottom="10dp"
android:textColor="#FFF"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical" >
<TextView
android:id="#+id/txt_dan2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:maxLength="3"
android:paddingTop="10dp"
android:textColor="#FFF"
android:textSize="20sp" />
<ImageView
android:id="#+id/img_dan2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="#drawable/img11d" />
<TextView
android:id="#+id/txt_stupnjevi2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:textColor="#FFF"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical" >
<TextView
android:id="#+id/txt_dan3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:maxLength="3"
android:paddingTop="10dp"
android:textColor="#FFF"
android:textSize="20sp" />
<ImageView
android:id="#+id/img_dan3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="#drawable/img13n" />
<TextView
android:id="#+id/txt_stupnjevi3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:textColor="#FFF"
android:textSize="18sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/txt_stupnjevi"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/txt_grad"
android:layout_marginRight="16dp"
android:orientation="vertical"
android:weightSum="3" >
<TextView
android:id="#+id/txt_tlak"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_weight="1"
android:drawablePadding="10dip"
android:drawableRight="#drawable/e2"
android:gravity="center_vertical|center_horizontal"
android:textColor="#FFF"
android:textSize="18sp" />
<TextView
android:id="#+id/txt_vlaznost"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_weight="1"
android:drawablePadding="10dip"
android:drawableRight="#drawable/d1"
android:gravity="center_vertical|center_horizontal"
android:textColor="#FFF"
android:textSize="18sp" />
<TextView
android:id="#+id/txt_brzina"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_weight="1"
android:drawablePadding="10dip"
android:drawableRight="#drawable/wind"
android:gravity="center_vertical|center_horizontal"
android:textColor="#FFF"
android:textSize="18sp" />
</LinearLayout>
<TextView
android:id="#+id/txt_stanje"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/linearLayout1"
android:layout_centerHorizontal="true"
android:layout_marginBottom="10dp"
android:textColor="#FFF"
android:textSize="18sp" />
</RelativeLayout>
What I should do to solve this?
i got this error too:
The markup in the document following the root element must be well-formed.
Just replace
<com.admob.android.ads.AdView android:id="#+id/ad"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
myapp:backgroundColor="#000000"
myapp:primaryTextColor="#FFFFFF"
myapp:secondaryTextColor="#CCCCCC"></com.admob.android.ads.AdView>