Android Development the new boston *Email* - java

I am on the 36th tutorial of thenewboston android app development on youtube. He has had us copy and paste our code (cause we are supposed to know how to do it by now). I copied and pasted it, didnt work so i tried typing it all out. Still didnt work. My R.id isnt working. I have already had problems with this before so i knew to check my XML file. and in there everything is crazy. I get an error everywhere i have android:layout_width="match_parent". Did some research and i guess that got updated to "fill_parent" changed that, now I get an error in my XML saying "error: ERROR parising XML: not well-formed (invalid token)". I have tried starting over mulitple times. cleaning project. Restarting. Triple checking my code. I dont know what im doing wrong. please help guys! Im going nuts!! Thanks in advanced.
<?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="fill_parent"
android:weightSum="100"
<ScrollView
android:layout_weight="30"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:text="Email address(es):"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<EditText
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:id="#+id/etEmails"
/>
<TextView
android:text="Hatfull intro"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<EditText
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:id="#+id/etIntro"
/>
<TextView
android:text="Persons name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/etName"
/>
<TextView
android:text="Stupid things this person does:"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<EditText
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:id="etThings"
/>
<TextView
android:text="What do you want to do to this person?"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<EditText
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:id="#+id/etAction"
/>
<TextView
android:text="Hatefull Outro"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/etOutro"
/>
</LinearLayout>
</ScrollView>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="40">
<Button
android:text="Send"
android:id="#+id/bSentEmail"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</Button>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="30">
<AnalogClock
android:id="#+id/analogClock1"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</AnalogClock>
</LinearLayout>
</LinearLayout>

You missed a > at the end of line 6:
change
android:weightSum="100"
to
android:weightSum="100">

Related

Android weightSum does not work

i have coded a ListViewAdapter to show rows in an activity with special Items. But my problem it isn't working as it should. My goal is, that the elements in a row have a fixed size and therefore i used weightSum. They should have a percentage.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="100.0">
<TextView
android:id="#+id/txtID"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="8.0"
android:text="TextView" />
<TextView
android:id="#+id/txtVis1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="36.0"
android:text="TextView" />
<View
android:layout_width="2dp"
android:layout_height="match_parent"
android:layout_marginRight="5dp"
android:background="#android:color/darker_gray" />
<TextView
android:id="#+id/txtVis2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="36.0"
android:text="TextView" />
<EditText
android:id="#+id/editVis1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="10.0"
android:inputType="number|numberSigned|numberDecimal|numberPassword|phone"
android:text="" />
<EditText
android:id="#+id/editVis2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="10.0"
android:inputType="number|numberSigned|numberDecimal|numberPassword|phone"
android:text="" />
</LinearLayout>
And here is, how it looks like. Its obvious wrong. It should be alle the same size and in the middle should be the black line on every row at the same position
The strange think is that it worked in a very early build and now it does not work anymore. What can i do?
If you need other code just tell me ;-) Thanks.

merging contents run time error in android studio

I have problem with the XML file in android studio I'm very new to it and I want to design a text and below the text, there are two buttons but when it runs all content located at (0,0) location at the end only the last button appear in the device
here's my code
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.tabarek.mysecondapplication.MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Information!"
android:id="#+id/hello"
/>
<Button
android:id="#+id/button"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:onClick="SayHi"
android:text="About Me"
android:layout_below="#+id/hello"
/>
<Button
android:id="#+id/button2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:onClick="SayHi"
android:text="My Email"
android:layout_below="#+id/button"
/>
</android.support.constraint.ConstraintLayout>
at the end,
the result appears like this
can you help me, please?
try this use LinearLayout
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/hello"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Information!" />
<Button
android:id="#+id/button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="SayHi"
android:text="About Me" />
<Button
android:id="#+id/button2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="SayHi"
android:text="My Email" />
</LinearLayout>

Type error: Error parsing XML: junk after document element about_window.xml?

This is my code. All I did is that I changed the texts in the about window in all layouts file and I find this error in the xml file.
Multiple annotations found at this line:
error: Error parsing XML: junk after document element
The markup in the document following the root element must be well-
also in the src files the error is "R cannot be resolved to a variable". This is my the XML code:
version="1.0" encoding="utf-8"?>
<ScrollView android:orientation="vertical"
android:scrollbars="none"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android"/>
<LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"
android:xmlns:android="http://schemas.android.com/apk/res/android"/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="6.0dip"
android:layout_marginTop="6.0dip"
android:text="xxxxxx"
android:textColor="#ffffffff"
android:textSize="14.0dip"
android:textStyle="bold" />
<TextView android:textSize="14.0dip" android:textStyle="bold" android:textColor="#ffffffff" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft="6.0dip" android:layout_marginTop="10.0dip" android:text="#string/app_version_name" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="6.0dip"
android:text="xxxxx"
android:textColor="#ffffffff"
android:textSize="14.0dip"
android:textStyle="bold" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="6.0dip"
android:layout_marginTop="10.0dip"
android:text="xxxxxxx"
android:textColor="#ffffffff"
android:textSize="14.0dip" />
<TextView
android:id="#id/dev_email"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="6.0dip"
android:layout_marginTop="20.0dip"
android:gravity="center_horizontal"
android:text="youss.boss1dev#gmail.com"
android:textColor="#2704fc"
android:textSize="14.0dip"
android:textStyle="bold" />
<LinearLayout android:gravity="center" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="10.0dip"
android:xmlns:android="http://schemas.android.com/apk/res/android"/>
<Button
android:id="#id/close_btn"
android:layout_width="110.0dip"
android:layout_height="44.0dip"
android:layout_marginBottom="4.0dip"
android:layout_marginTop="4.0dip"
android:text="xxxx" />
</LinearLayout>
</LinearLayout>
</ScrollView>
This is the perfect Layout.
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:scrollbars="none">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:xmlns="http://schemas.android.com/apk/res/android">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="6.0dip"
android:layout_marginTop="6.0dip"
android:text="xxxxxx"
android:textColor="#ffffffff"
android:textSize="14.0dip"
android:textStyle="bold"/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="6.0dip"
android:layout_marginTop="10.0dip"
android:text="app_version_name"
android:textColor="#ffffffff"
android:textSize="14.0dip"
android:textStyle="bold"/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="6.0dip"
android:text="xxxxx"
android:textColor="#ffffffff"
android:textSize="14.0dip"
android:textStyle="bold"/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="6.0dip"
android:layout_marginTop="10.0dip"
android:text="xxxxxxx"
android:textColor="#ffffffff"
android:textSize="14.0dip"/>
<TextView
android:id="#+id/dev_email"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="6.0dip"
android:layout_marginTop="20.0dip"
android:gravity="center_horizontal"
android:text="youss.boss1dev#gmail.com"
android:textColor="#2704fc"
android:textSize="14.0dip"
android:textStyle="bold"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10.0dip"
android:gravity="center"
android:orientation="vertical"
android:xmlns="http://schemas.android.com/apk/res/android">
<Button
android:id="#+id/close_btn"
android:layout_width="110.0dip"
android:layout_height="44.0dip"
android:layout_marginBottom="4.0dip"
android:layout_marginTop="4.0dip"
android:text="xxxx"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
Your scroll view ends with a /> finishing the object, I think childrem will not have access to the tags android.
All your views are closed by itself (with "/>"). So your document doesnt have a root, only a list.
Also: Childs doesnt needs to declare xmlns again, such the second object:
android:xmlns:android="http://schemas.android.com/apk/res/android"
That also has a typo with android twice.
Also:
Do any text contains > or < ? It should be added into the strings.xml so those characters can appear
You have an error in LinearLayout:
android:xmlns:android="http://schemas.android.com/apk/res/android"
it should be:
xmlns:android="http://schemas.android.com/apk/res/android"
you typed twice android. Instead removing just android remove whole line you don't need it because you already have declaration in ScrollView Actually the problem is ScrollView can contain only one direct child and you have multiple. So you have to put all your xml code below ScrollView in one container either LinearLayout, RelativeLayout etc.

How to switch between Activities in Android using only xml code

Hello I have a app im working on that I lost the source code to when my computer crashed I was able to decompile my apk to make it a project again however I need to make a few changes to it so what i need help with is this i have a sliding drawer that has a button in it I want it to open the play store when the user clicks it I know how to do this via a java activity however it only decompiled my code via smali code so I need to know if there is a way to open the play store from a button click via xml
here's my Main code:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout android:id="#id/frame" android:focusable="true" android:focusableInTouchMode="true" android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<com.d4a.tobiaslauncher.AnimationOnResume android:id="#id/animation_on_resume" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="fill_parent" />
<com.d4a.tobiaslauncher.AnimationOpenFolder android:id="#id/animation_open_folder" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="fill_parent" />
<LinearLayout android:gravity="center_horizontal" android:orientation="vertical" android:id="#id/folder_container" android:visibility="invisible" android:layout_width="fill_parent" android:layout_height="fill_parent">
<FrameLayout android:id="#id/folder_title_area" android:layout_width="fill_parent" android:layout_height="1.0dip" android:layout_marginLeft="7.0dip" android:layout_marginRight="7.0dip">
<EditText android:textSize="36.0dip" android:textColor="#ffffffff" android:gravity="center" android:layout_gravity="center_vertical" android:id="#id/folder_title" android:background="#drawable/folder_title" android:layout_width="fill_parent" android:layout_height="58.0dip" android:includeFontPadding="false" android:inputType="text" android:textCursorDrawable="#drawable/caret" />
<Button android:layout_gravity="right|center" android:id="#id/folder_title_clear" android:background="#drawable/folder_title_xbutton" android:layout_width="19.0dip" android:layout_height="19.0dip" android:layout_marginRight="16.0dip" />
</FrameLayout>
<net.suckga.ilauncher.paging.PageScrollView android:id="#id/folder_scroll_container" android:visibility="invisible" android:scrollbars="none" android:fadingEdge="none" android:layout_width="1.0dip" android:layout_height="1.0dip">
<LinearLayout android:orientation="horizontal" android:id="#id/folder_scroll_content" android:layout_width="wrap_content" android:layout_height="fill_parent" />
</net.suckga.ilauncher.paging.PageScrollView>
<com.d4a.tobiaslauncher.PageIndicator android:layout_gravity="bottom" android:id="#id/folder_page_indicator" android:visibility="invisible" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="-17.0dip" />
</LinearLayout>
<RelativeLayout android:layout_gravity="top" android:id="#id/springboard_container" android:layout_width="fill_parent" android:layout_height="fill_parent">
<com.d4a.tobiaslauncher.DockBar android:id="#id/dockBar" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" />
<com.d4a.tobiaslauncher.PageIndicator android:id="#id/page_indicator" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_above="#id/dockBar" />
<net.suckga.ilauncher.paging.PageScrollView android:id="#id/scrollContainer" android:visibility="invisible" android:scrollbars="none" android:fadingEdge="none" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_above="#id/page_indicator">
<LinearLayout android:orientation="horizontal" android:id="#id/scrollView" android:layout_width="wrap_content" android:layout_height="fill_parent" />
</net.suckga.ilauncher.paging.PageScrollView>
<fragment android:name="com.d4a.tobiaslauncher.QuickLaunch"
android:id="#+id/quicklaunch"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="bottom"/>
</RelativeLayout>
<com.d4a.tobiaslauncher.MovingIconView android:id="#id/panelMoving" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="fill_parent" android:contentDescription="#null" />
<LinearLayout android:gravity="center" android:id="#id/logoPanel" android:background="#ff000000" android:layout_width="fill_parent" android:layout_height="fill_parent">
<ImageView android:id="#id/logo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="#drawable/logo" android:contentDescription="#null" />
</LinearLayout>
</FrameLayout>
Sliding Drawer code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<SlidingDrawer android:id="#id/slidingDrawer" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginBottom="4.0dip" android:handle="#id/handle" android:content="#id/content">
<ImageView android:id="#id/handle" android:layout_width="fill_parent" android:layout_height="20.0dip" />
<LinearLayout android:orientation="vertical" android:id="#id/content" android:background="#color/drawerbg" android:layout_width="fill_parent" android:layout_height="wrap_content">
<include android:id="#id/web" android:layout_width="fill_parent" android:layout_height="72.0dip" android:layout_marginLeft="15.0dip" android:layout_marginTop="8.0dip" android:layout_marginRight="15.0dip" android:layout_marginBottom="8.0dip" android:onClick="web" layout="#layout/web_card" />
<include android:id="#id/mail" android:layout_width="fill_parent" android:layout_height="72.0dip" android:layout_marginLeft="15.0dip" android:layout_marginTop="8.0dip" android:layout_marginRight="15.0dip" android:layout_marginBottom="8.0dip" android:onClick="email" layout="#layout/email_card" />
<include android:id="#id/musiccard" android:layout_width="fill_parent" android:layout_height="72.0dip" android:layout_marginLeft="15.0dip" android:layout_marginTop="8.0dip" android:layout_marginRight="15.0dip" android:layout_marginBottom="8.0dip" android:onClick="music" layout="#layout/music_card" />
<include android:id="#id/playcard" android:layout_width="fill_parent" android:layout_height="72.0dip" android:layout_marginLeft="15.0dip" android:layout_marginTop="8.0dip" android:layout_marginRight="15.0dip" android:layout_marginBottom="8.0dip" android:onClick="play" layout="#layout/playstore_card" />
<include android:layout_gravity="center" android:id="#id/buttons" android:layout_width="wrap_content" android:layout_height="wrap_content" layout="#layout/buttons2" />
</LinearLayout>
</SlidingDrawer>
</RelativeLayout>
Playstore Button card:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:background="#drawable/card_background" android:layout_width="fill_parent" android:layout_height="fill_parent" android:onClick="play"
xmlns:android="http://schemas.android.com/apk/res/android">
<ImageView android:id="#id/playicon" android:padding="5.0dip" android:layout_width="68.0dip" android:layout_height="68.0dip" android:src="#drawable/play" android:layout_centerVertical="true" />
<TextView android:textSize="30.0sp" android:textColor="#color/cardText" android:id="#id/play" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Google Play" android:layout_toRightOf="#id/playicon" android:layout_centerVertical="true" />
</RelativeLayout>
any help would be awesome
Thanks way in advance!!
You cannot do this with only XML code. You must create an OnClickListener or declare a onClick method and start the Activity in Java.
Maybe I'm misunderstanding your question. If so, I'm sorry, please let me know, and I'll change my answer.
But if you have a button and you want to go to a different activity it is very simple.
Simply add:
android:onClick="functionName"
to the XML of the button.
Then in your java, create a function called functionName that takes View view as a parameter and then create an intent to the new activity and start it.
public void functionName(View view) {
Intent intent = new Intent(getApplication(),classToGoTo.class);
startActivity(intent);
}
Or however else you want to go to that other activity. Or whatever else you want to do. Just put it inside of the functionName function.
I hope this helps. Good luck :)

creating a new linear layout

i created button and other...
but now when i want to create a three buttons green,red,blue they are not showing up i want them to be directly down the button1 but they are not showing up i wish you can help me this is the error im getting -xml documents must start and end within the same entity the error is showing in the last last last linearlayout
this is the code im having problem with
<?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" >
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical" >
<TextView
android:id="#+id/secondLine"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/Greetings"
android:textSize="20sp" />
<Button
android:id="#+id/Button1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/hello" />
</LinearLayout>
<RelativeLayout
android:id="#+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
</RelativeLayout>
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="fill_parent"
android:layout_height="20dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/thirdLine"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_gravity="center"
android:background="#ff0000"
android:textColor="#000000"
android:text="red" />
<TextView
android:id="#+id/fourthLine"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_gravity="center"
android:background="#00ff00"
android:textColor="#000000"
android:text="green" />
<TextView
android:id="#+id/fifthLine"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_gravity="center"
android:background="#0000ff"
android:textColor="#000000"
android:text="blue" />
<RelativeLayout
android:id="#+id/relativeLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
</RelativeLayout>
</LinearLayout>
this is a picture for the red blue green buttons where to be while mine are down
https://www.dropbox.com/s/73grdc0iff3ql3u/Untitled.png
this is what i reached to till now but i want them to be equally distributed like the picture above
https://www.dropbox.com/s/73grdc0iff3ql3u/Untitled.png
you have not closed the below linear layout tag in your xml.
"<"LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="fill_parent"
android:layout_height="20dp"
android:orientation="horizontal" ">"
You need one more </LinearLayout> at the end of your xml file. At the minute, only 2 of the 3 LinearLayout's are being closed.
EDIT
The reason your Buttons are appearing at the bottom is because of this:
<RelativeLayout
android:id="#+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
</RelativeLayout>
I'm not sure what purpose this serves in your application, but removing that will fix your problem.
Replace your xml with following code
<?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" >
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:weightSum="10" >
<TextView
android:id="#+id/secondLine"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="20sp" />
<Button
android:id="#+id/Button1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="HelloWord" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="5dp"
android:weightSum="10" >
<TextView
android:id="#+id/thirdLine"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3.3"
android:background="#ff0000"
android:text="red"
android:textColor="#000000"
android:gravity="center" />
<TextView
android:id="#+id/fourthLine"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3.4"
android:background="#00ff00"
android:text="green"
android:textColor="#000000"
android:gravity="center" />
<TextView
android:id="#+id/fifthLine"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3.3"
android:background="#0000ff"
android:text="blue"
android:textColor="#000000"
android:gravity="center"/>
</LinearLayout>
</LinearLayout>
Hope it will help you.

Categories

Resources