TextView showing very small in the screen - android

In my app I have the following layout, and no matter what value I give the textview doesn't change its width. Can someone please help me in correcting this layout.
Here is the XML code:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:layout_marginTop="15dp"
android:descendantFocusability="blocksDescendants" >
<TableRow
android:layout_width="match_parent"
android:gravity="center_horizontal" >
<TextView
android:id="#+id/rec_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/fill_rece"
android:ems="10"
android:focusable="false"
android:padding="10dp"
android:textColor="#FFFFFF" />
<ImageButton
android:id="#+id/btn_rec_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="#string/content"
android:src="#drawable/ipad_postcare_landscape_from" />
</TableRow>
</TableLayout>
I also get a warning near TableRow saying "This TableRow layout or its TableLayout parent is useless". Please guide me.
Thanks in advance.

Try this one Insted of table use Linear Layout with and set LAYOUT_WEIGHT property. This property shares the equal amount of space for text view and image button
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<TextView
android:id="#+id/rec_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/fill_rece"
android:focusable="false"
android:padding="10dp"
android:textColor="#FFFFFF" />
<ImageButton
android:id="#+id/btn_rec_delete"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:contentDescription="#string/content"
android:src="#drawable/ipad_postcare_landscape_from" />
</LinearLayout>

try this....,you can add android:textSize="some value" which you want t o give
<TextView
android:id="#+id/rec_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="false"
android:padding="10dp"
android:text="hllo"
android:textSize="25dp" />

You might need to use
android:layout_weight
I am mentioning one example for your help, also make sure your every element has height and weight with it, to display everything correctly
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="#drawable/layout_border"
android:weightSum="1.0"
android:id="#+id/r1c1r2">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:textIsSelectable="true"
android:id="#+id/key"/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:textIsSelectable="true"
android:id="#+id/key2" />
</LinearLayout>

Give the textsize using:
android:textSize="some value"

try to give size according to your requirement you have the width of the table row and textview set as match_parent hence it(textview) can't change it's size.
android:layout_width="50dp"

Related

LinearLayout doesn't work. Title does not show up?

I have a question for you all. When I have a simple text in an xml file in eclipse. Why doesn't the title show up?
I have searched for similar problems, but can't find it on stackoverflow. Hopefully someone can help me.
unfortunately, I can't post pictures. Well, the text: #string/ondergewicht is the title of the text.
#/string/ondergewichttekst is the text wich I've used.
And this is the code I've used. Sorry if this is a stupid question, and I'm sure it is..
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<TextView
android:id="#+id/ondergewichttekst"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textStyle="italic"
android:layout_marginTop="80dp"
android:gravity="center"
android:text="#string/ondergewichttekst"
android:textSize="16sp"/>
<TextView
android:id="#+id/ondergewicht"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textStyle="italic"
android:gravity="center"
android:layout_marginTop="1dp"
android:text="#string/ondergewicht"
android:textSize="30sp"
/>
</LinearLayout>
So, the ondergewichttekst is showed, but the overgewicht is not. Maybe is there something like an text order?
Hopefully someone can help me out.
Jacob
Try this code ... It works fine for me.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:id="#+id/ondergewichttekst"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="italic"
android:layout_marginTop="80dp"
android:gravity="center"
android:text="#string/ondergewichttekst"
android:textSize="16sp"/>
<TextView
android:id="#+id/ondergewicht"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="italic"
android:gravity="center"
android:layout_marginTop="1dp"
android:text="#string/ondergewicht"
android:textSize="30sp"
/>
</LinearLayout>
Try this one
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/ondergewicht"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="italic"
android:gravity="center"
android:layout_marginTop="1dp"
android:text="#string/ondergewicht"
android:textSize="30sp" />
<TextView
android:id="#+id/ondergewichttekst"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="italic"
android:layout_marginTop="80dp"
android:gravity="center"
android:text="#string/ondergewichttekst"
android:textSize="16sp" />
</LinearLayout>
You have horizontal orientation in your Linear Layout and your first TextView has layout_width = match_parent This doesn't make sense, there is no more room for the second TextView.
Use vertical orientation of layout or use wrap_content instead of match_parent for widths and heights.
You have android:layout_width="match_parent" in both TextViews of a horizontal LinearLayout so the first TextView is taking up all of the width. Change them to wrap_content.
<TextView
android:id="#+id/ondergewichttekst"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textStyle="italic"
android:layout_marginTop="80dp"
android:gravity="center"
android:text="#string/ondergewichttekst"
android:textSize="16sp"/>
<TextView
android:id="#+id/ondergewicht"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:textStyle="italic"
android:gravity="center"
android:layout_marginTop="1dp"
android:text="#string/ondergewicht"
android:textSize="30sp"/>

fill parent on a textview doesn't apply

I know this question has been asked multiple times, but I have looked on all the solution I could see and none of them worked.
I have a textview inside a relative-layout. the textview has a height : fill_parent atribute that does not work. the pun is that they are severall other textview in this relative-layoutwhich all manage to fill parent,except for this one.
here is the 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="wrap_content"
android:background="#drawable/customshape"
android:orientation="horizontal" >
<TextView
android:id="#+id/mainlistdescription"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:scrollHorizontally="true"
android:maxLines="4"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="#+id/mainlistquantite"
android:layout_gravity="center_vertical"
android:textSize="12sp"
android:padding="10dp"
/>
<TextView
android:id="#+id/mainlistquantite"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:maxLines="4"
android:layout_toLeftOf="#+id/consultaffichelayoutdroit"
android:textSize="12sp"
android:padding="10dp"
/>
<TextView
android:id="#+id/consultafficheseparator" <!-- the one not working-->
android:layout_width="2dp"
android:layout_height="fill_parent"
android:layout_toLeftOf="#+id/imageView1"
android:background="#777777"
android:maxWidth="2dp" />
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="15dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:gravity="center_vertical|right"
android:src="#drawable/fleche" />
<LinearLayout
android:id="#+id/consultaffichelayoutdroit"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_toLeftOf="#+id/consultafficheseparator"
android:orientation="vertical"
android:paddingLeft="5dp"
>
<TextView
android:id="#+id/mainlistnumero"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="right"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:id="#+id/mainlistprix"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="right"
android:layout_marginRight="10dp"
android:layout_weight="1" />
</LinearLayout>
</RelativeLayout>
here is what i get :
the grey bar should go all the way but doesn't when actually running on the emulator( it does in the eclipse tool)
since this xml is actually called in a list view, I can't seem to fix the problem using JAVA code, so the solution would ideally be on the XML file. I tryed so far android:clipChildren="false" without sucess, as well as changing the order of my elements in the XML, wich juste made it worse.
after experiment,I can tell nothing takes the place so it's not the it cannot go because there is allready a view there,it just doesn't expand that far
thanks for the help on that
Why are you using a TextView to draw a separator? Try with a normal view like the code below.
Also, if the seperator has to align to the bottom of your description view, you can use the layout_alignBottom-property of RelativeLayout like this:
android:layout_alignBottom="#+id/mainlistdescription"
So the separator would look something like the code below:
<View
android:id="#+id/consultafficheseparator"
android:layout_width="2dp"
android:layout_height="match_parent"
android:layout_toLeftOf="#+id/imageView1"
android:layout_alignBottom="#+id/mainlistdescription"
android:background="#color/separator_bg" />
Below some other tips:
It's better to define a color in some resource-file (eg. colors.xml) and refer to that color from inside your layout. Especially when using it in a ListView
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="separator_bg">#777777</color>
</resources>
And in your layout-file android:background="#color/separator_bg"
Use match_parent instead of fill_parent because that's deprecated.
I see android:scrollHorizontally="true" on one of the TextView's. That only works when the TextView is editable. If you want the content to scroll because it doesn't fit in the TextView, try to use the code below:
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
And in your adapter.getView():
final TextView description = (TextView) view.findViewById(R.id.mainlistdescription);
description.setSelected(true);
It looks like your TextView is not at the top level, maybe you can try the following in your code:
consultafficheseparatorTextView.bringToFront();
Had the same pesky problem which by the way makes no sense. What worked for me in the end was changing the android:layout_height in RelativeLayout tag to fill_parent like this
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/customshape"
android:orientation="horizontal">
hope this helps
Try setting one (or all) of the following to see if it changes anything:
android:maxHeight="100dp"
or
android:layout_height="100dp"
or
android:text="a"
android:textColor="#777777"
If any of these options change the size, please let me know and we can work on a proper solution!
It's very strange you get such view of this layout, because after copy&paste of your layout code I've got this one.
Your solution works, I've made some minor improvments. It's like your code, but there is no need to use TextView if you need background color only, View could be used instead.
<View
android:id="#+id/consultafficheseparator"
android:layout_width="2dp"
android:layout_height="match_parent"
android:layout_toLeftOf="#+id/imageView1"
android:background="#777777"
/>
Only suggestion is to set root layout height "match_parent" or some value in dp, like thiagolr proposed. I've set it to "100dp" for this screenshot.
This is what you should do,
<?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="wrap_content"
android:background="#drawable/customshape"
android:orientation="horizontal" >
<TextView
android:id="#+id/mainlistdescription"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:scrollHorizontally="true"
android:maxLines="4"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="#+id/mainlistquantite"
android:layout_gravity="center_vertical"
android:textSize="12sp"
android:padding="10dp"
/>
<TextView
android:id="#+id/mainlistquantite"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:maxLines="4"
android:layout_toLeftOf="#+id/consultaffichelayoutdroit"
android:textSize="12sp"
android:padding="10dp"
/>
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="15dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:gravity="center_vertical|right"
android:src="#drawable/fleche" />
<TextView
android:id="#+id/consultafficheseparator" <!-- this will work now -->
android:layout_width="2dp"
android:layout_height="fill_parent"
android:layout_toLeftOf="#+id/imageView1"
android:background="#777777"
android:maxWidth="2dp" />
<LinearLayout
android:id="#+id/consultaffichelayoutdroit"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_toLeftOf="#+id/consultafficheseparator"
android:orientation="vertical"
android:paddingLeft="5dp"
>
<TextView
android:id="#+id/mainlistnumero"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="right"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:id="#+id/mainlistprix"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="right"
android:layout_marginRight="10dp"
android:layout_weight="1" />
</LinearLayout>
</RelativeLayout>
1)Try to make your Linear Layout orientation vertical
or
2)Try to make your Relative Layout orientation vertical
it can be help.

Adding ScrollView to RelativeLayout changes position of wigdets

The following is the XML of my layout. It explicitly states that the title, time and description TextViews should be under the image of the alarm. However, as the screen shot shows, the TextViews have moved into the ImageView. Why does this happen and how can I fix this? The problem only started happening when I added the scrollview.
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" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
android:id="#+id/img_alarm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/alarm"
android:layout_centerInParent="true"
android:contentDescription="#string/content_description_layout_alarm"/>
<TextView
android:id="#+id/lbl_alarm_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20dip"
android:textStyle="bold"
android:layout_centerHorizontal="true"
android:layout_below="#+id/img_alarm"
android:layout_alignLeft="#+id/img_alarm"
android:text="#string/empty"
/>
<TextView
android:id="#+id/lbl_alarm_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20dip"
android:textStyle="bold"
android:layout_centerHorizontal="true"
android:layout_below="#+id/img_alarm"
android:layout_alignRight="#+id/img_alarm"
android:text="#string/empty"
/>
<TextView
android:id="#+id/lbl_alarm_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="#+id/lbl_alarm_title"
android:layout_alignLeft="#+id/lbl_alarm_title"
android:layout_alignRight="#+id/lbl_alarm_time"
android:maxLines="1"
android:ellipsize="marquee"
android:text="#string/empty"
/>
<Button
android:id="#+id/btn_stop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/lbl_alarm_description"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dip"
android:paddingLeft="20dip"
android:paddingRight="20dip"
android:text="#string/stop_layout_alarm"
android:gravity="center" />
</RelativeLayout>
</ScrollView>
Image
Cute app :)
hmm... not sure why it's doing it, looks like you have the right code, without busting out eclipse. but i've also had some weird bugs with relativelayout that i didn't understand and didn't have time to debug.
i do know of an alternative way you can accomplish what you're looking for -
have a scrollview that encases a linearlayout instead of a relative layout. Do these things:
For the linearlayout, you can set orientation = vertical so that it's still a top down order.
For the part where you need two textviews where one is aligned to the right and the other is aligned to the right, you need another inner linearlayout with its orientation=horizontal. then have one element align parent left, and the other align parent right. add a weightSum=1 attribute to this linearlayout and have each of the two textviews layout_width=0.5 so that each is half the width of the screen
Apply a weightSum=1 attribute to your outer most linearlayout, and see each element inside so that it's layout_weight sum adds up to 1. layout_weight will allow an element to take up that much % of real estate on the screen. like if you set your imageView to have android:layout_weight=0.8 then it'll take up 80% of the screen... since mathematically, (layout_weight/weightSum) = (.08/1) = 80%
try to use that mechanism instead, and if should work :) if it's confusing i can give code
example
<?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" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:weightSum="1">
<ImageView
android:id="#+id/img_alarm"
android:layout_width="match_parent"
android:layout_height="0dip"
android:src="#drawable/alarm"
android:layout_weight="0.7"
android:contentDescription="#string/content_description_layout_alarm"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.1">
<TextView
android:id="#+id/lbl_alarm_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textSize="20dip"
android:textStyle="bold"
android:text="#string/empty"
/>
<TextView
android:id="#+id/lbl_alarm_time"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textSize="20dip"
android:textStyle="bold"
android:text="#string/empty"
/>
</LinearLayout>
<TextView
android:id="#+id/lbl_alarm_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0.1"
android:maxLines="1"
android:ellipsize="marquee"
android:text="#string/empty"
/>
<Button
android:id="#+id/btn_stop"
android:layout_weight="0.1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="5dip"
android:paddingLeft="20dip"
android:paddingRight="20dip"
android:text="#string/stop_layout_alarm"
android:gravity="center" />
</LinearLayout>
</ScrollView>
i hope this deserves at least an upvote for the effort :D

Android - Align TextViews like a table row

I have a listview that I'm populating with data and I'm trying to get my layout to look like this:
Is there a way to create this while using Linear or Relative layouts? I tried with TableRows and while it works, it leaves a gap between for the column that divides the left from the right and it doesn't look appealing at all.
Not too sure where to get started....any help is greatly appreciated.
I am writing a sample for one line. Please refer that.
<LinearLayout
android:id="#+id/line1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:text="Issue Number"
android:layout_weight="1.0"
android:layout_height="wrap_content"
android:layout_width="0px"
android:gravity="right"/>
<TextView
android:text="6046"
android:layout_weight="1.0"
android:layout_height="wrap_content"
android:layout_width="0px"
android:gravity="left"/>
</LinearLayout>
You need to write this for all the lines and then enclose it under the parent LinearLayout with orientation vertical.
You can provide an xml to format each row in a ListView, whereby each row is a simple horizontal LinearLayout with two TextViews.
So something along the same lines as this:
http://www.heikkitoivonen.net/blog/2009/02/15/multicolumn-listview-in-android/
A more detailed article dealing with ListViews:
http://www.vogella.de/articles/AndroidListView/article.html
I created a layout with your firsts 2 rows:
<?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" >
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:gravity="right"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Issue Number:"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Date Received:"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_toRightOf="#+id/linearLayout1"
android:gravity="left"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="6,046"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="09/02/2008"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
</RelativeLayout>
You can actually do this by placing a 2 LinearLayout inside a single parent LinearLayout. Where parent android:orientation should be horizontal. For each row you need to use this technique.
I did use this method for my project.

layout problem in android

i try show layout like image 1 (textView and editText in same line) but my out put shown like image 2 !
i try with this code :
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="5px"
>
<TextView
android:id="#+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="URL:"
android:layout_alignBaseline="#+id/entry"
android:layout_alignParentLeft="true"/>
/>
<EditText
android:id="#+id/entry"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#id/label"
android:layout_alignParentTop="true"
/>
<Button
android:id="#+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingRight="30px"
android:paddingLeft="30px"
android:text="Go..."
/>
</LinearLayout>
please help me
thanks
Try this
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="#+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="URL:"
android:layout_alignBaseline="#+id/entry"
android:layout_alignParentLeft="true"/>
/>
<EditText
android:id="#+id/entry"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#id/label"
android:layout_alignParentTop="true"
/>
</LinearLayout>
<Button
android:id="#+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingRight="30px"
android:paddingLeft="30px"
android:text="Go..."
/>
</LinearLayout>
Or use RelativeLayout
Use RelativeLayout instead of Linear one and get use of android:rightOf.
As far as I understood, you cannot use such _toRightTop, _BOTTOM attributes with a linear Layout. Use RelativeLayout and all should be fine.
Use relative layout instead of linear layout.One advantage of this is that it improves your performance.if you try to search and id suing a linear layout,it will check with every component of the linear layout and try to match with its id but with relativer layout it will be faster as all elements are defined relative to each other.

Categories

Resources