I am trying to presnt the text that was back from the server on the UI. i succedd to get the data but for some reason my date (textViewDate) is not begin with the other lines such as place (textViewPlace) and time (textViewTime).
how can i align it in a proper way?
this is my xml code:
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/relativlayoutGcmMessage"
android:background="#ffffff">
<TextView
android:id="#+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="this is the message"
android:textSize="20sp"
android:layout_below="#+id/textViewUser"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_above="#+id/textViewloc" />
<LinearLayout
android:id="#+id/linearLayoutBtn"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:layout_marginTop="20dp"
android:layout_below="#+id/separatorDown"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<Button android:text="Join"
android:id="#+id/ButtonJoin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#ffffff"
android:background="#606060"
android:layout_below="#+id/linearLayoutBtn"
android:layout_toRightOf="#+id/textViewUser"
android:layout_toEndOf="#+id/textViewUser">
</Button>
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:id="#+id/separatorUp"
android:visibility="visible"
android:background="#FF0000"
android:layout_marginTop="25dp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:id="#+id/separatorDown"
android:visibility="visible"
android:background="#FF0000"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="User ,"
android:id="#+id/textViewUser"
android:layout_below="#+id/separatorUp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textStyle="bold"
android:layout_marginTop="5dp"
android:textSize="20sp"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="When:"
android:id="#+id/textViewWhen"
android:textStyle="bold"
android:textSize="20sp"
android:textColor="#000000"
android:layout_above="#+id/separatorDown"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginBottom="45dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Date"
android:id="#+id/textViewDate"
android:textSize="20sp"
android:layout_marginLeft="40dp"
android:layout_alignTop="#+id/textViewWhen"
android:layout_toRightOf="#+id/textViewUser"
android:layout_toEndOf="#+id/textViewUser" />
<Button android:text="Deny"
android:id="#+id/ButtonDeny"
android:layout_width="361dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:textColor="#ffffff"
android:background="#606060"
android:layout_below="#+id/linearLayoutBtn"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
</Button>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Between:"
android:id="#+id/textViewbtwn"
android:textColor="#000000"
android:textStyle="bold"
android:textSize="20sp"
android:layout_below="#+id/textViewDate"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Time"
android:id="#+id/textViewtime"
android:layout_marginLeft="10dp"
android:textSize="20sp"
android:layout_below="#+id/textViewDate"
android:layout_toRightOf="#+id/textViewbtwn"
android:layout_toEndOf="#+id/textViewbtwn" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Location:"
android:id="#+id/textViewloc"
android:layout_above="#+id/textViewWhen"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textStyle="bold"
android:textColor="#000000"
android:textSize="20sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="place"
android:id="#+id/textViewPlace"
android:layout_above="#+id/textViewDate"
android:layout_alignLeft="#+id/textViewtime"
android:layout_alignStart="#+id/textViewtime"
android:textSize="20sp" />
</RelativeLayout>
this is how its look like on my device:
Add this layoute Like this:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Date"
android:id="#+id/textViewDate"
android:textSize="20sp"
android:layout_alignTop="#+id/textViewWhen"
android:layout_toRightOf="#+id/textViewUser"
android:layout_toEndOf="#+id/textViewUser" />
in This code has Remove This Line..
android:layout_marginLeft="40dp"
I think its Work.
Use a Table layout
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Location:"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="place"
/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="When:"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Date"
/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Between:"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Time"
/>
</TableRow>
</TableLayout>
Also remove the margin property from DATE text.
Related
This is the my current listivew:
My problem is i can't display my last item in the list. It's like getting cut by my phone.
Here is the xml code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="1">
<RelativeLayout
android:orientation="vertical"
android:id="#+id/border"
android:layout_width="match_parent"
android:layout_height="280dp"
android:background="#drawable/dfcomment3"
android:layout_weight="0.07">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:text="Add comment"
android:id="#+id/button12"
android:layout_marginTop="215dp"
android:layout_marginLeft="5dp" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:text="Update Post"
android:id="#+id/button13"
android:layout_marginTop="215dp" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:text="Close This"
android:id="#+id/button14"
android:layout_marginTop="215dp" />
</LinearLayout>
<TextView
android:layout_marginLeft="10dp"
android:textSize="35dp"
android:id="#+id/textView11"
android:gravity="center"
android:text="ID"
android:textStyle="bold"
android:textColor="#994495"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/textView12"
android:text="Name"
android:textSize="16dp"
android:textColor="#994495"
android:layout_marginTop="190dp"
android:layout_marginLeft="210dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/textView13"
android:text="Lastname"
android:textStyle="bold"
android:textSize="16dp"
android:layout_marginLeft="90dp"
android:textColor="#994495"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/id"
android:layout_toEndOf="#+id/id"
android:layout_marginTop="5dp" />
<TextView
android:id="#+id/textView14"
android:text="title"
android:textSize="15dp"
android:textColor="#994495"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="260dp"
android:layout_below="#+id/name"
android:layout_alignStart="#+id/name"
android:layout_marginTop="190dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="descr"
android:textSize="21dp"
android:textColor="#994495"
android:id="#+id/textView15"
android:layout_marginLeft="110dp"
android:layout_marginTop="60dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="dept"
android:textStyle="italic"
android:textColor="#994495"
android:id="#+id/textView16"
android:layout_marginLeft="180dp"
android:layout_marginTop="30dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="tags"
android:textStyle="italic"
android:textSize="14dp"
android:textColor="#994495"
android:id="#+id/textView17"
android:layout_marginLeft="120dp"
android:layout_marginTop="30dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="status"
android:textSize="25dp"
android:textStyle="bold"
android:textColor="#70CC86"
android:id="#+id/textView18"
android:layout_marginLeft="290dp"
android:layout_marginTop="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="date"
android:textColor="#994495"
android:id="#+id/textView19"
android:layout_marginLeft="10dp"
android:layout_marginTop="190dp" />
</RelativeLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_height="match_parent" >
<ListView
android:id="#+id/listView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</LinearLayout>
As much as possible i want to stick with the listview because i'm not familiar with the recyclerview. if theres any way to fix this, i would be glad.
Check the image for the reference of my problem.
There's actually 4 items in the list and i can only view 2 items.
Firstly there is problem with your XML as when you use weightsum and layout_weight then you need not give dimensions in height or width.
This must be your XML.
Also I checked your XML there is some problem in you XML attributes too. Like you used "android:layout_below="#+id/id"" but in your xml there is no "id"
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="100">
<RelativeLayout
android:orientation="vertical"
android:id="#+id/border"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="#drawable/dfcomment3"
android:layout_weight="70">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:text="Add comment"
android:id="#+id/button12"
android:layout_marginTop="215dp"
android:layout_marginLeft="5dp" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:text="Update Post"
android:id="#+id/button13"
android:layout_marginTop="215dp" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:text="Close This"
android:id="#+id/button14"
android:layout_marginTop="215dp" />
</LinearLayout>
<TextView
android:layout_marginLeft="10dp"
android:textSize="35dp"
android:id="#+id/textView11"
android:gravity="center"
android:text="ID"
android:textStyle="bold"
android:textColor="#994495"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/textView12"
android:text="Name"
android:textSize="16dp"
android:textColor="#994495"
android:layout_marginTop="190dp"
android:layout_marginLeft="210dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/textView13"
android:text="Lastname"
android:textStyle="bold"
android:textSize="16dp"
android:layout_marginLeft="90dp"
android:textColor="#994495"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/id"
android:layout_toEndOf="#+id/id"
android:layout_marginTop="5dp" />
<TextView
android:id="#+id/textView14"
android:text="title"
android:textSize="15dp"
android:textColor="#994495"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="260dp"
android:layout_below="#+id/name"
android:layout_alignStart="#+id/name"
android:layout_marginTop="190dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="descr"
android:textSize="21dp"
android:textColor="#994495"
android:id="#+id/textView15"
android:layout_marginLeft="110dp"
android:layout_marginTop="60dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="dept"
android:textStyle="italic"
android:textColor="#994495"
android:id="#+id/textView16"
android:layout_marginLeft="180dp"
android:layout_marginTop="30dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="tags"
android:textStyle="italic"
android:textSize="14dp"
android:textColor="#994495"
android:id="#+id/textView17"
android:layout_marginLeft="120dp"
android:layout_marginTop="30dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="status"
android:textSize="25dp"
android:textStyle="bold"
android:textColor="#70CC86"
android:id="#+id/textView18"
android:layout_marginLeft="290dp"
android:layout_marginTop="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="date"
android:textColor="#994495"
android:id="#+id/textView19"
android:layout_marginLeft="10dp"
android:layout_marginTop="190dp" />
</RelativeLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_weight="30"
android:layout_height="0dp" >
<ListView
android:id="#+id/listView"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
</LinearLayout>
Add your java code if you are not getting 4 values into your ListView
Change you xml to :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="1">
<RelativeLayout
android:orientation="vertical"
android:id="#+id/border"
android:layout_width="match_parent"
android:layout_height="280dp"
android:layout_weight="0.07"--> Delete this
>
....
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_weight="1" -> Add this
android:layout_height="0dp" >
<ListView
android:id="#+id/listView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</LinearLayout>
I am trying to align my buttons at the bottom of the screen using layouts but I cannot figure what's wrong with my code. I have tried several options by nesting different layouts but with no good outcome. it looks like this right now
And my code:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/ScrollView01"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/relLayout"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:clickable="true"
android:focusableInTouchMode="true"
tools:context="com.example.aurora.personalinformation.MainActivity">
<!-- Make the parent view clickable and focusable -->
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/title"
android:layout_centerHorizontal="true"
android:id="#+id/title"
android:textColor="#FF0000"
android:textSize="25dp"
android:textAlignment="center" />
<TextView
android:id="#+id/nameLable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/name"
android:textColor="#000000"
android:textStyle="bold"
android:textSize="15dp"
android:layout_marginTop="40dp"
android:layout_below="#id/title"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<EditText android:id="#+id/edit_name"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Enter name"
android:layout_alignBottom="#id/nameLable"
android:layout_toRightOf="#+id/phoneLable"
android:layout_toEndOf="#+id/phoneLable"
/>
<TextView
android:id="#+id/addressLable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/address"
android:textColor="#000000"
android:textSize="15dp"
android:textStyle="bold"
android:layout_alignBottom="#+id/addressField"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<EditText
android:id="#+id/addressField"
android:layout_weight="0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Enter your address"
android:layout_below="#id/edit_name"
android:layout_alignLeft="#id/edit_name"
android:layout_alignStart="#id/edit_name" />
<TextView
android:id="#+id/phoneLable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/phone"
android:textColor="#000000"
android:textStyle="bold"
android:textSize="15dp"
android:layout_below="#id/addressField"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="20dp"/>
<EditText
android:id="#+id/phoneField"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Enter your phone number"
android:layout_below="#id/addressField"
android:layout_toRightOf="#id/phoneLable"
android:layout_toEndOf="#id/phoneLable" />
<TextView
android:id="#+id/emailLable"
android:layout_below="#id/phoneLable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/email"
android:textColor="#000000"
android:textSize="15dp"
android:textStyle="bold"
android:layout_marginTop="20dp"/>
<EditText
android:id="#+id/emailField"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Enter your email"
android:layout_below="#id/phoneField"
android:layout_alignLeft="#id/phoneField"
android:layout_alignStart="#id/phoneField" />
<TextView
android:id="#+id/genderLable"
android:layout_below="#id/emailLable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/gender"
android:layout_marginTop="20dp"
android:textColor="#000000"
android:textStyle="bold"
android:textSize="15dp" />
<Spinner
android:id="#+id/gender"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:entries="#array/gender"
android:layout_alignTop="#+id/genderLable"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignLeft="#+id/emailField"
android:layout_alignStart="#+id/emailField" />
<TextView
android:id="#+id/country"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Country"
android:textColor="#000000"
android:textSize="15dp"
android:textStyle="bold"
android:layout_below="#id/gender"
android:layout_marginTop="15dp"/>
<AutoCompleteTextView
android:id="#+id/countryField"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Enter your email"
android:layout_below="#id/gender"
android:layout_toRightOf="#id/phoneLable"
android:layout_toEndOf="#id/phoneLable" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="bottom"
android:layout_alignParentBottom="true">
<Button
android:id="#+id/buttonSave"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Send"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<Button
android:id="#+id/buttonCancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cancel"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</RelativeLayout>
</ScrollView>
just give your last RelativeLayout like this:
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="bottom"
android:layout_below="#+id/countryField"
android:layout_alignParentBottom="true">
<Button
android:id="#+id/buttonSave"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Send"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<Button
android:id="#+id/buttonCancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Cancel"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
One more thing there is no meaning to give an orientation to RelativeLayout.
I would like to know if there is a way to place all the textviews that start with little bit space regarding the layout they located. For example I want that in the follwoing image all the textvies will not touch in the border of layout sucah as the word "place","location","Between","When" are doing.
This is current situation:
and this is my xml code:
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/relativlayoutGcmMessage"
android:background="#ffffff">
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:id="#+id/separatorUp"
android:visibility="visible"
android:background="#FF0000"
android:layout_marginTop="25dp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<RelativeLayout
android:layout_width="match_parent"
android:id="#+id/textlayout"
android:layout_marginTop="5dp"
android:layout_below="#+id/separatorUp"
android:background="#drawable/edit_text_style_focused"
android:layout_margin="10dp"
android:layout_height="wrap_content"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="User ,"
android:gravity="center"
android:id="#+id/textViewUser"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textStyle="bold"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:textSize="20sp"
android:textColor="#FF0000" />
<TextView
android:id="#+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="this is the message"
android:textSize="20sp"
android:layout_marginLeft="5dp"
android:layout_below="#+id/textViewUser"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textColor="#000000" />
</RelativeLayout>
<LinearLayout
android:id="#+id/linearLayoutBtn"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<Button
android:text="Join"
android:id="#+id/ButtonJoin"
android:textColor="#ffffff"
android:background="#606060"
android:layout_margin="10dp"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_alignParentBottom="true"
android:layout_height="wrap_content"
>
</Button>
<Button
android:text="Deny"
android:id="#+id/ButtonDeny"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_margin="10dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:textColor="#ffffff"
android:background="#606060"
>
</Button>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:id="#+id/relativeLayoutTextVals"
android:layout_marginTop="20dp"
android:layout_margin="10dp"
android:background="#drawable/edit_text_style_focused"
android:layout_below="#+id/textlayout"
android:layout_height="wrap_content">
<TableRow
android:layout_width="match_parent"
android:id="#+id/row2"
android:layout_below="#+id/row1"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Between:"
android:id="#+id/textViewbtwn"
android:textColor="#FF0000"
android:textStyle="bold"
android:textSize="20sp"
android:layout_weight="0.62" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Time"
android:id="#+id/textViewtime"
android:layout_marginLeft="10dp"
android:textSize="20sp"
android:layout_weight="1.45"
android:textColor="#000000" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:id="#+id/row3"
android:layout_below="#+id/row2"
android:layout_height="wrap_content">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Location:"
android:id="#+id/textViewloc"
android:textStyle="bold"
android:textColor="#FF0000"
android:textSize="20sp"
android:layout_weight="1" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="place"
android:layout_marginLeft="10dp"
android:id="#+id/textViewPlace"
android:textSize="20sp"
android:layout_weight="2.28"
android:textColor="#000000" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:id="#+id/row1"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_gravity="center">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="When:"
android:id="#+id/textViewWhen"
android:textStyle="bold"
android:textSize="20sp"
android:textColor="#FF0000"
android:layout_weight="51.15" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Date"
android:layout_marginLeft="10dp"
android:id="#+id/textViewDate"
android:textSize="20sp"
android:layout_weight="115.29"
android:textColor="#000000" />
</TableRow>
</RelativeLayout>
</RelativeLayout>
Try another approach as follows , it works as per your requirement
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/relativlayoutGcmMessage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff">
<View
android:id="#+id/separatorUp"
android:layout_width="fill_parent"
android:layout_height="1dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginTop="25dp"
android:background="#FF0000"
android:visibility="visible" />
<RelativeLayout
android:id="#+id/textlayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/separatorUp"
android:layout_margin="10dp"
android:layout_marginTop="5dp"
android:padding="10dp">
<TextView
android:id="#+id/textViewUser"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:gravity="center"
android:text="User ,"
android:textColor="#FF0000"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="#+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="#+id/textViewUser"
android:layout_marginLeft="5dp"
android:text="this is the message"
android:textColor="#000000"
android:textSize="20sp" />
</RelativeLayout>
<LinearLayout
android:id="#+id/linearLayoutBtn"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:orientation="horizontal">
<Button
android:id="#+id/ButtonJoin"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_margin="10dp"
android:layout_weight="1"
android:background="#606060"
android:text="Join"
android:textColor="#ffffff"></Button>
<Button
android:id="#+id/ButtonDeny"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_margin="10dp"
android:layout_weight="1"
android:background="#606060"
android:text="Deny"
android:textColor="#ffffff">
</Button>
</LinearLayout>
<RelativeLayout
android:id="#+id/relativeLayoutTextVals"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/textlayout"
android:layout_margin="10dp"
android:layout_marginTop="20dp">
<LinearLayout
android:id="#+id/row2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/row1"
android:layout_margin="5dp">
<TextView
android:id="#+id/textViewbtwn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Between:"
android:textColor="#FF0000"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="#+id/textViewtime"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:text="Time"
android:textColor="#000000"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/row3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/row2"
android:layout_margin="5dp">
<TextView
android:id="#+id/textViewloc"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Location:"
android:textColor="#FF0000"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="#+id/textViewPlace"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:text="place"
android:textColor="#000000"
android:textSize="20sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/row1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_gravity="center"
android:layout_margin="5dp"
android:orientation="horizontal"
android:weightSum="2">
<TextView
android:id="#+id/textViewWhen"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="When:"
android:textColor="#FF0000"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="#+id/textViewDate"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:text="Date"
android:textColor="#000000"
android:textSize="20sp" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
I have login layout,when progress bar executes the layout shifts, This my xml code please check my code.And help me to rseolve.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:flatui="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:wheel="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mobile Number"
android:layout_marginTop="60dp"
android:layout_marginLeft="20dp"
android:textSize="15dp"
android:layout_marginBottom="40dp"
android:textStyle="bold" />
<EditText
android:id="#+id/mnum"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/edit_text_design"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="90dp"
android:layout_marginBottom="40dp"
style="#style/EditBoxStyle"
android:inputType="phone"
android:maxLength="10"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Password"
android:layout_marginTop="150dp"
android:layout_marginLeft="20dp"
android:textSize="15dp"
android:layout_marginBottom="40dp"
android:textStyle="bold" />
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/edit_text_design"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="175dp"
android:layout_marginBottom="40dp"
style="#style/EditBoxStyle"
android:inputType="textPassword"
android:id="#+id/pswrd" />
<com.cengalabs.flatui.views.FlatButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Login"
android:id="#+id/loginBtn"
android:layout_gravity="center_horizontal"
android:layout_marginTop="235dp"
flatui:fl_touchEffect="fl_ripple"
flatui:fl_theme="#array/grass"
flatui:fl_blockButtonEffectHeight="3dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="40dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/frgtext"
android:layout_gravity="center_horizontal"
android:text="Forgot Password?"
android:autoText="false"
android:clickable="true"
android:layout_alignParentBottom="false"
android:layout_centerHorizontal="true"
android:layout_marginTop="300dp"
android:textColor="#ff666666"
android:textSize="20dp"
android:textStyle="bold" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<!-- <ProgressBar
android:id="#+id/loading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/loginBtn"
android:layout_centerHorizontal="true"
/>-->
<com.pnikosis.materialishprogress.ProgressWheel
android:id="#+id/loading"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
wheel:matProg_barColor="#ff5cb85c"
wheel:matProg_progressIndeterminate="true" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity = "bottom"
android:layout_alignParentBottom="true"
>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TableRow>
<Button
android:layout_marginLeft="-5dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_weight="1"
android:id="#+id/ntregtext"
android:text="New Registration"
android:textColor="#ff666666"
android:layout_marginRight="0dp"
android:textAllCaps="false"
android:textStyle="bold" />
<Button
android:layout_marginLeft="-8dp"
android:layout_marginRight="-5dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="2dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:text="Check our offers"
android:textColor="#ff666666"
android:textAllCaps="false"
android:textStyle="bold" />
</TableRow>
</TableLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:layout_marginTop="50dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginBottom="5dp"
android:textAlignment="gravity"
android:textAllCaps="false"
android:textStyle="bold"
android:gravity="center_horizontal"
android:layout_centerHorizontal="true" />
</RelativeLayout>
</LinearLayout>
Attached Images before progress bar and after progress bar running................................................
Instead of Table layout used Liner layout given weightsum as total item in horizontal.
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity = "bottom"
android:layout_alignParentBottom="true"
>
<!-- <TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TableRow>-->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2">
<Button
android:layout_marginLeft="-5dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_weight="1"
android:id="#+id/ntregtext"
android:text="New Registration"
android:textColor="#ff666666"
android:layout_marginRight="0dp"
android:textAllCaps="false"
android:textStyle="bold" />
<Button
android:layout_marginLeft="-8dp"
android:layout_marginRight="-5dp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginTop="2dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:text="Check our offers"
android:textColor="#ff666666"
android:textAllCaps="false"
android:textStyle="bold" />
<!-- </TableRow>
</TableLayout>-->
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="sad"
android:layout_marginTop="50dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginBottom="5dp"
android:textAlignment="gravity"
android:textAllCaps="false"
android:textStyle="bold"
android:gravity="center_horizontal"
android:layout_centerHorizontal="true" />
</RelativeLayout>
I have made a simple form in android and have put all the form contents in that scrollView but my scrollView doesnt working ,It not scrolls down,My code is as below:
main.xml
<?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" >
<View
android:id="#+id/line"
android:layout_width="fill_parent"
android:layout_height="7dp"
android:layout_alignParentTop="true"
android:background="#4fc1e9" />
<TextView
android:id="#+id/title_reg"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/line"
android:gravity="center"
android:padding="13dp"
android:text="#string/title_registration"
android:textColor="#cecece"
android:textSize="16dp"
android:textStyle="bold" />
<RelativeLayout
android:id="#+id/btn_qq_login"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/title_reg" >
<TextView
android:id="#+id/tv_qq_login"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="#5d9cec"
android:gravity="center"
android:padding="12dp"
android:text="#string/qq_login"
android:textColor="#ffffff"
android:textSize="18dp"
android:textStyle="bold" />
</RelativeLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="#+id/btn_qq_login"
android:fillViewport="true" >
<RelativeLayout
android:id="#+id/rl_1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/txt_or"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center"
android:text="#string/or"
android:textColor="#cecece"
android:textSize="16dp"
android:textStyle="bold" />
<TextView
android:id="#+id/txt_reg_new_account"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/txt_or"
android:autoLink="web"
android:gravity="center"
android:text="#string/reg_new_account"
android:textColor="#cecece"
android:textColorLink="#cecece"
android:textSize="16dp"
android:textStyle="bold" />
<TextView
android:id="#+id/txt_ur_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/txt_reg_new_account"
android:layout_marginLeft="20dp"
android:layout_marginTop="5dp"
android:text="#string/reg_name"
android:textColor="#cecece"
android:textSize="14dp" />
<EditText
android:id="#+id/et_txt_ur_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/txt_ur_name"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="#drawable/bg_editext"
android:hint="#string/hint_reg_name"
android:padding="8dp"
android:textColorHint="#cecece"
android:textSize="14dp" />
<TextView
android:id="#+id/txt_ur_email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/et_txt_ur_name"
android:layout_marginLeft="20dp"
android:layout_marginTop="5dp"
android:text="#string/reg_email"
android:textColor="#cecece"
android:textSize="14dp" />
<EditText
android:id="#+id/et_txt_ur_email"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/txt_ur_email"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="#drawable/bg_editext"
android:hint="#string/hint_reg_email"
android:padding="8dp"
android:textColorHint="#cecece"
android:textSize="14dp" />
<TextView
android:id="#+id/txt_ur_phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/et_txt_ur_email"
android:layout_marginLeft="20dp"
android:layout_marginTop="5dp"
android:text="#string/reg_phone_number"
android:textColor="#cecece"
android:textSize="14dp" />
<EditText
android:id="#+id/et_txt_ur_phone"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/txt_ur_phone"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="5dp"
android:background="#drawable/bg_editext"
android:hint="#string/hint_reg_phone_number"
android:padding="8dp"
android:textColorHint="#cecece"
android:textSize="14dp" />
<TextView
android:id="#+id/txt_ur_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/et_txt_ur_phone"
android:layout_marginLeft="20dp"
android:layout_marginTop="5dp"
android:text="#string/reg_pwd"
android:textColor="#cecece"
android:textSize="14dp" />
<EditText
android:id="#+id/et_txt_ur_password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/txt_ur_password"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="15dp"
android:background="#drawable/bg_editext"
android:hint="#string/hint_reg_pwd"
android:padding="8dp"
android:textColorHint="#cecece"
android:textSize="14dp" />
</RelativeLayout>
</ScrollView>
<RelativeLayout
android:id="#+id/reg_bottom"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#f5f7f9"
android:paddingBottom="5dp" >
<Button
android:id="#+id/btn_register"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="15dp"
android:background="#drawable/btn_register"
android:gravity="center"
android:text="#string/btn_reg"
android:textColor="#ffffff" />
<TextView
android:id="#+id/txt_already_member"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/btn_register"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:text="#string/txt_already_member"
android:textColor="#babfc3"
android:textSize="12dp" />
<TextView
android:id="#+id/txt_already_login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/btn_register"
android:layout_centerHorizontal="true"
android:layout_marginLeft="3dp"
android:layout_marginTop="5dp"
android:layout_toRightOf="#+id/txt_already_member"
android:autoLink="web"
android:text="#string/txt_already_login"
android:textColor="#3a91ea"
android:textColorLink="#cecece"
android:textSize="12dp" />
</RelativeLayout>
<ImageView
android:id="#+id/iv_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="15dp"
android:layout_marginTop="47dp"
android:background="#drawable/qq" />
</RelativeLayout>
Please help me sort it out..Thank you
you have problem with ScrollView.you need to specify to the scroll view for scrolling.
just add below property in to ScrollView
android:layout_above="#+id/reg_bottom"
you need to bind your scroll view.
thanx.