I am not able to render EditText properly it going outside the screen
but in Graphical Layout tab in eclipse it is showing properly.
Please help I am new to android. I have written the sample code for 1st row
<RelativeLayout xmlns:android="http://*****.*****.***/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:background="#FFFFFF" >
<TableLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp">
<TableRow>
<TextView
android:id="#+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/editText2"
android:layout_alignParentLeft="true"
android:layout_marginBottom="29dp"
android:layout_marginLeft="0dp"
android:text="Counter Id"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000000" />
<EditText
android:id="#+id/editText1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/textView1"
android:layout_alignBottom="#+id/textView1"
android:layout_marginLeft="0dp"
android:layout_toRightOf="#+id/textView1"
android:ems="10" />
</TableRow>
</TableLayout>
Use Linear Layout with weight sum.
http://developer.android.com/reference/android/widget/LinearLayout.html
Or
Use Different Layouts for different Screen Size.
for Eg: LDPI, MDPI, HDPI, XHDPI, XXHDPI ect.
Related
I am trying to add the image in Edit box with some text, but it is not showing the image. It is showing only texts.
Here is my xml.
<Button
android:id="#+id/favButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add to "
android:drawableRight="#drawable/white_star"
android:layout_below="#id/priceText"
android:layout_alignParentLeft="true"
android:background="#drawable/rounded_corner_black"
android:padding="10dip"
style="#style/ButtonText"
android:onClick="onAddFavClick" />
Here is my Java Code.
private void updateFavButton() {
if (atmItem.isFav()) {
favButton.setText("Remove from ");
} else {
favButton.setText("Add to ");
}
}
You can try this way also
<EditText
android:drawableLeft="#drawable/your_image" />
Or for a reference you can StackOverFlow Answer
So for that you can use android:drawableRight=""
The feature you want is known as CompoundDrawable.
There are attributes which you can set inside your EditText:
android:drawableLeft
android:drawableRight
android:drawableTop
android:drawableBottom
In your case, as you want to display image on right hand side, use android:drawableRight.
I got the image simply with the following method
favButton.setCompoundDrawablesWithIntrinsicBounds( 0, 0,R.drawable.white_star, 0);
This is the simple way if you want to go forward with XML
<RelativeLayout
android:id="#+id/edittext"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/searchcards_back_relative" >
<ImageView
android:id="#+id/leftbutton"
android:layout_alignParentLeft="true"
android:layout_width="wrap_content"
android:layout_height="46dp"
android:background="#drawable/searchleft"/>
<LinearLayout android:focusable="true"
android:id="#+id/searchcards_edit_search_lin"
android:focusableInTouchMode="true"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#id/leftbutton"
android:layout_centerHorizontal="true"
android:layout_marginLeft="0px"
android:background="#drawable/searchmiddle">
<EditText
android:hint="Search Cards"
android:id="#+id/searchcards_edit_search"
android:layout_width="fill_parent"
android:layout_height="28dp"
android:textColor="#000000"
android:textSize="18dp"
android:singleLine="true"
android:background="#0fff"
android:layout_alignParentLeft="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="21dp"
android:gravity="center_vertical"
android:layout_marginTop="0dp"
android:imeOptions="actionSearch"
android:layout_gravity="center_vertical"/>
</LinearLayout>
<ImageView
android:id="#+id/rightbutton"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="46dp"
android:background="#drawable/searchright"/>
<TextView
android:id="#+id/searchcards_back_hitsearch"
android:layout_width="35dp"
android:layout_height="40dp"
android:textSize="25px"
android:textStyle="bold"
android:layout_centerVertical="true"
android:textColor="#android:color/white"
android:layout_alignParentRight="true"
android:background="#0222"
android:text=""/>
</RelativeLayout>
<ListView
android:id="#+id/searchcards_list"
android:layout_width="wrap_content"
android:background="#drawable/background"
android:layout_height="fill_parent"
android:layout_below="#+id/edittext"
android:divider="#fff"
android:dividerHeight="1px"
android:cacheColorHint="#android:color/transparent"
android:layout_marginBottom="4px"
android:scrollbars="none" />
</RelativeLayout>
you should use .png images in drawable folder for left, middle and right images.
you can also take relative layout for doing this ... for more keep googling...
Please have a look at the following simple code.
<TextView
android:id="#+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="John Jonathan Samuwell Abbruzzi"
android:singleLine="true"
android:scrollHorizontally="true"
android:textSize="50sp" />
The text in TextView is larger than the width of the screen and should be in single line. I added android:scrollHorizontally="true", so the user can scroll it to see the rest of the text. But, it is not happening. What have I done wrong?
Put your textview inside the HorizontalScrollView its working i am tested..
<HorizontalScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
android:id="#+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="John Jonathan Samuwell Abbruzzi"
android:singleLine="true"
android:scrollHorizontally="true"
android:textSize="50sp" />
</HorizontalScrollView>
You need to use HorizontalScrollView with single line. If you want horizontal scrollbar for multiple views then you can create layout in HorizontalScrollView and scroll complete. HorizontalScrollView can only hold one direct child.
<HorizontalScrollView
android:id="#+id/horizontalScrollView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="40dp" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="91dp"
android:singleLine="true"
android:text="my view" />
</HorizontalScrollView>
I have a custom DialogPreference with my own layout defined. The layout file is as follows:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="5dp"
android:paddingLeft="10dp"
android:paddingRight="10dp" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/enter_password_label"
android:textAppearance="?android:attr/textAppearanceLarge" />
<EditText
android:id="#+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword">
<requestFocus />
</EditText>
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/confirm_password_label"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
<EditText
android:id="#+id/editText2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
/>
On the displayed dialog both TextViews are missing:
What is the reason of TextViews not being displayed?
One of the reason for this behavior is due to manufacturer's customization of themes. Other reasons could be that the selected text appearance has same color as of background. To avoid this, you may simply set a color to your TextView, for e.g.:
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/enter_password_label"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#000000" />
*Also make sure android:text does have a text to show on screen
I am trying to scroll my textview using the following code:
TextView text = (TextView) findViewById(R.id.textView12);
text.setMovementMethod(ScrollingMovementMethod.getInstance());
int height = getResources().getDrawable(R.drawable.pic_ground_pranic).getIntrinsicHeight();
text.setLayoutParams(new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT, height));
text.setText("As part of an Android App I am building a button set.For performance reasons and to keep the code simpler, the Android system uses pixels as the standard unit for expressing dimension or coordinate values. That means that the dimensions of a view are always expressed in the code using pixels, but always based on the current screen density. For instance, if myView.getWidth() returns 10, the view is 10 pixels wide on the current screen, but on a device with a higher density screen, the value returned might be 15. If you use pixel values in your application code to work with bitmaps that are not pre-scaled for the current screen density, you might need to scale the pixel values that you use in your code If you need to control exactly how your application will look on various screen configurations, adjust your layouts and bitmap drawables in configuration-specific resource directories. For example, consider an icon that you want to display on medium and high density screens. Simply create your icon at two different sizes (for instance 100x100 for medium density and 150x150 for high density) and put the two variations in the appropriate directories, using the proper qualifiers: For instance, suppose a device has a WVGA high-density screen, which is 480x800 and about the same size as a traditional HVGA screen, but it's running an application that has disabled pre-scaling. In this case, the system will lie to the application when it queries for screen dimensions, and report 320x533 (the approximate mdpi translation for the screen density). Then, when the application does drawing operations, such as invalidating the rectangle from (10,10) to (100, 100), the system transforms the coordinates by scaling them the appropriate amount, and actually invalidate the region (15,15) to (150, 150). This discrepancy may cause unexpected behavior if your application directly manipulates the scaled bitmap, but this is considered a reasonable trade-off to keep the performance of applications as good as possible. If you encounter this situation, read Based on the density of the current screen, the system uses any size- or density-specific resources from your application and displays them without scaling. If resources are not available in the correct density, the system loads the default resources and scales them up or down as needed to match the current screen's density. The system assumes that default resources (those from a directory without configuration qualifiers) are designed for the baseline screen density (mdpi), unless they are loaded from a density-specific resource directory. Pre-scaling is, thus, what the system does when resizing a bitmap to the appropriate size for the current screen density. to match the un-scaled bitmap source. The buttons are part of a nested set of LinearLayouts.The question then is: How to resize the layout.I have tried several suggested techniques, and none come close to working. Here is a subset of the XML that builds the button set:");
All is working fine but my text view is not scrolling smoothly. I thought I have to put my Textview inside a Scrollview but this is also not working.
Does it happen because I am resizing my textview?
Please provide any solution for this problem. I already spent a lot of time on this.
My xml layout file is:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/relativeLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="#+id/include1"
android:layout_centerHorizontal="true"
android:background="#android:color/white"
android:scrollbarStyle="insideInset" >
<TableLayout
android:id="#+id/tableLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="5dp" >
<TableRow
android:id="#+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<RelativeLayout
android:id="#+id/relativeLayout2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1.0" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="5dp"
android:layout_marginTop="14dp"
android:text="Text 1"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView2"
android:layout_marginLeft="25dp"
android:layout_toRightOf="#+id/textView2"
android:text="Text 2"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/textView3"
android:layout_marginLeft="25dp"
android:layout_toRightOf="#+id/textView3"
android:text="Text 3"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/textView4"
android:layout_marginLeft="25dp"
android:layout_toRightOf="#+id/textView4"
android:text="Text 4"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/textView2"
android:layout_marginLeft="5dp"
android:layout_marginTop="3dp"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView3"
android:layout_below="#+id/textView3"
android:layout_marginTop="3dp"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView4"
android:layout_below="#+id/textView4"
android:layout_marginTop="3dp"
android:textColor="#android:color/black" />
<TextView
android:id="#+id/textView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView5"
android:layout_below="#+id/textView5"
android:layout_marginTop="3dp"
android:textColor="#android:color/black" />
</RelativeLayout>
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<RelativeLayout
android:id="#+id/relativeLayout3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1.0" >
<SeekBar
android:id="#+id/seekBar1"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:soundEffectsEnabled="true" />
<TextView
android:id="#+id/textView10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="Volume 1"
android:textColor="#android:color/black" />
</RelativeLayout>
</TableRow>
<TableRow
android:id="#+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<RelativeLayout
android:id="#+id/relativeLayout4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1.0" >
<SeekBar
android:id="#+id/seekBar2"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:soundEffectsEnabled="true" />
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="Volume 2"
android:textColor="#android:color/black" />
</RelativeLayout>
</TableRow>
<TableRow
android:id="#+id/tableRow4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:baselineAligned="false" >
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:orientation="vertical" >
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="Save Volumes" />
</LinearLayout>
</TableRow>
<TableRow
android:id="#+id/tableRow5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<FrameLayout
android:id="#+id/frameLayout3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:orientation="vertical" >
<TextView
android:id="#+id/textView12"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center_vertical|center_horizontal"
android:gravity="top|left"
android:scrollbars="vertical"
android:visibility="visible" />
</FrameLayout>
</TableRow>
<TableRow
android:id="#+id/tableRow8"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<FrameLayout
android:id="#+id/frameLayout2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1.0" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|center" />
<TextView
android:id="#+id/textView13"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|center"
android:layout_marginRight="30dp"
android:clickable="true"
android:text="Detailed Instruction" />
</FrameLayout>
</TableRow>
</TableLayout>
</ScrollView>
</RelativeLayout>
Thanks in advance!
In my case I just needed to put my TextView inside a ScrollView. Scrolling got very smooth and users lived happily every after!
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
>
<TextView
android:id="#+id/textview_about"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textIsSelectable="true"
android:textSize="20dp" />
</ScrollView>
problem is ScrollView inside ScrollView.
When you put ScrollView inside ScrollView android just get confused which scroll view is touched. So sometimes it gets unable to deliver touch event.
After searching for a time I found a link or blog that will extract this problem and also have solution.
Take a look at this blog. This is exactly what you have been searching for and i am sure that it will solve your problem.
Now time to Enjoy ;)
The TextView scroll only if you restrict its height. Simple rule is when the text is more then the available space then textview start scrolling.
One way is what you are following by assigning a fixed height which you got from some image size. One other way is by setting the maximum number of lines.
TextView text = (TextView) findViewById(R.id.textView12);
text.setMaxLines(5);
text.setMovementMethod(ScrollingMovementMethod.getInstance());
you can even make it more dynamic. Simply by calculating number of lines.
Number of lines = (image Height in pixels)/(text font size in pixel)
First of all there is no need of the setting the Layoutparams as because you have give it in to the xml layout.
And if you have such long string then dont put it directly on java code. Instead of it put that string to the resources directory.
go to values, and open strings.xml file and define your string.
See below:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, HelperStackOverflowActivity!</string>
<string name="app_name">HelperStackOverflow</string>
<string name="String1">"PUT YOUR STRING HERE" </string>
</resources>
After doing that set the string in Java code whenever you want.
as like:
text = (TextView)findViewById(R.id.textView12);
text.setText(getResources().getString(R.string.String1));
it Scroll nice as normal scrolling.
Hope it will help you.
Enjoy. :)
I've create a very simple app and i download it in 15 different devices. For some of them the layout have no resize problem and appear like this:
Layout that should be in all layouts
But when i installed the app in a Sansung Galaxy Neo Plus and in the tablet Archos 101 Copper the items' layout were not in the position that i want. In the tablet are up of the background different color view and in the Galaxy Neo Plus are like this:
Layout in the Galaxy Neo Plus
To auto-resize, in the activities xml, i used thse codes:
android:layout_marginTop="125dp"
android:layout_marginBottom="15dp"
android:layout_marginRight="20dp"
android:layout_marginLeft="20dp"
to set the buttons' margin from top/bottom/left/right
android:textSize="30dp"
to set the size of buttons' text
The layout code is this:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/bg"
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Al meglio di:"
android:textSize="22dp"
android:id="#+id/almegliodi"
android:layout_alignParentTop="true"
android:layout_marginTop="220dp"
android:layout_centerHorizontal="true"
android:typeface="serif"
android:textStyle="bold|italic"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="center" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" UNO "
android:textStyle="bold"
android:textSize="35dp"
android:textColor="#android:color/white"
android:id="#+id/uno"
android:background="#android:drawable/dialog_holo_dark_frame"
android:onClick="uno"
android:layout_below="#+id/almegliodi"
android:layout_marginTop="30dp"
android:layout_centerHorizontal="true"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" TRE "
android:textStyle="bold"
android:textSize="35dp"
android:textColor="#android:color/white"
android:id="#+id/tre"
android:background="#android:drawable/dialog_holo_dark_frame"
android:onClick="tre"
android:layout_centerHorizontal="true"
android:layout_below="#+id/uno"
android:layout_marginTop="30dp"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" CINQUE "
android:textStyle="bold"
android:textSize="35dp"
android:textColor="#android:color/white"
android:id="#+id/cinque"
android:background="#android:drawable/dialog_holo_dark_frame"
android:onClick="cinque"
android:layout_centerHorizontal="true"
android:layout_below="#+id/tre"
android:layout_marginTop="30dp"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ESCI"
android:textStyle="bold"
android:textSize="30dp"
android:id="#+id/esci"
android:background="#android:color/transparent"
android:layout_marginBottom="7dp"
android:layout_marginLeft="30dp"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:onClick="esci"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="INDIETRO"
android:textStyle="bold"
android:textSize="30dp"
android:textColor="#android:color/white"
android:id="#+id/indietro"
android:background="#android:color/transparent"
android:onClick="indietro"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_alignTop="#+id/esci"
android:layout_marginRight="30dp"
android:layout_marginBottom="7dp"
/>
</RelativeLayout
I searched on google but i found that use the 'dp' is the best way to auto-resize margin and text in all device.
What are my mistakes? What i have to do to solve the compatibility?
Thank you
Here is an example how your layout could look like:
<?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:background="#005"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="150dp"
android:layout_gravity="center_horizontal"
android:src="#android:drawable/btn_star_big_on"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center_horizontal"
android:layout_margin="24dp"
android:layout_weight="1"
android:background="#cfff"
android:gravity="center"
android:orientation="vertical">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"/>
<android.support.v4.widget.Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"/>
</LinearLayout>
</LinearLayout>
You should of cause use #string/ for each button to make your app translatable, but that basic layout should give you the right idea how to make a layout which scales correctly.
Basically I use some linear layouts which just say how the views should been arranged (horizontal or vertical). Then I told the view which contains the three main buttons that its height should be zero (just for performance) and the most important part that the layout weight is 1 (android:layout_weight="1") that tells the system to split up the open space to all views with a weight attribute. So this one will fill your display as far as possible. The other views will still been rendered as you want in my case wrap_content.