I'm trying to study the Google i/o 2014's app.
Inside the BaseActivity it has this method:
protected Toolbar getActionBarToolbar() {
if (mActionBarToolbar == null) {
mActionBarToolbar = (Toolbar) findViewById(R.id.toolbar_actionbar);
if (mActionBarToolbar != null) {
setSupportActionBar(mActionBarToolbar);
}
}
return mActionBarToolbar;
}
Why findViewById dosen't return null? :/
The content view of the WelcomeActivity does this: setContentView(R.layout.activity_welcome); and this is the activity_welcome.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:iosched="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.WelcomeActivity">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#e5e5e5">
<ImageView
android:src="#drawable/io2014_logo"
android:layout_width="200dp"
android:layout_height="100dp"
android:scaleType="fitCenter"
android:tint="#7000"
android:layout_gravity="center|top" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="100dp"
android:clipToPadding="false">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
iosched:cardBackgroundColor="#fff"
iosched:cardCornerRadius="#dimen/card_corner_radius"
iosched:cardElevation="#dimen/card_elevation"
iosched:cardPreventCornerOverlap="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="24dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#string/font_fontFamily_medium"
android:text="#string/welcome_to_google_i_o_app"
android:textColor="#color/theme_primary"
android:textSize="#dimen/text_size_xlarge"
android:textStyle="#integer/font_textStyle_medium" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:autoLink="web"
android:text="#string/welcome_text"
android:textColor="#color/body_text_2"
android:textSize="#dimen/text_size_medium" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:autoLink="web"
android:text="#string/eula_legal_text"
android:textColor="#color/body_text_2"
android:textSize="#dimen/text_size_medium" />
</LinearLayout>
</android.support.v7.widget.CardView>
</FrameLayout>
</ScrollView>
</FrameLayout>
<!-- Button bar -->
<LinearLayout
android:layout_height="48dp"
android:background="#color/theme_primary"
android:layout_gravity="bottom"
android:layout_width="match_parent">
<Button
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:background="?photoItemForeground"
android:text="#string/decline"
android:textColor="#8fff"
android:textSize="#dimen/text_size_medium"
android:textStyle="#integer/font_textStyle_medium"
android:fontFamily="#string/font_fontFamily_medium"
android:textAllCaps="true"
android:id="#+id/button_decline" />
<Button
android:id="#+id/button_accept"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:background="?photoItemForeground"
android:text="#string/accept"
android:textSize="#dimen/text_size_medium"
android:textStyle="#integer/font_textStyle_medium"
android:fontFamily="#string/font_fontFamily_medium"
android:textAllCaps="true"
android:textColor="#fff" />
</LinearLayout>
</LinearLayout>
So it dosen't include in any way the toolbar_actionbar.xml. Also i looked inside the style.xml for some hint (maybe it was included in all files in some way) but i really can't find anything.
Thanks for help
Here is what is going on:
1) WelcomeActivity does not extends from BaseActivity, so getActionBarToolbar() will not be called on this case.
2) Activities that are subclasses of BaseActivity have <include layout="#layout/toolbar_actionbar" /> somewhere on their view hierarchy.
They have a layout named https://github.com/google/iosched/blob/master/android/src/main/res/layout/toolbar_actionbar.xml
which they < include > in their Activities layouts
Take a look at this guy over here. He explains it perfectly.
Google Documentation:
http://android-developers.blogspot.cz/2014/10/appcompat-v21-material-design-for-pre.html
http://developer.android.com/reference/android/widget/Toolbar.html
Here is Google Design Spec you can take a look:
https://www.google.com/design/spec/material-design/introduction.html
Hope it helps!!!
Related
why my last row is hidden in listview?
Hello, why my last row is hidden in listview?
Hello, why my last row is hidden in listview?
I have changed the xml code 1000 times already and still can't fix it.
SwipeRefreshLayout work good.
enter image description here
fragment_list.xml
`
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="#+id/refreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="8dp">
<ListView
android:id="#+id/list_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:cacheColorHint="#android:color/transparent"
android:listSelector="#android:color/transparent"
android:divider="#null"
android:dividerHeight="0dp">
</ListView>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</LinearLayout>
<com.google.android.material.textview.MaterialTextView
android:id="#+id/empty"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="#string/empty_list_text" />
</RelativeLayout>
`
list_row.xml
`
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.material.card.MaterialCardView
android:id="#+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:rippleColor="#android:color/transparent"
card_view:cardElevation="0dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
app:strokeWidth="0dp"
app:cardElevation="0dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.material.imageview.ShapeableImageView
android:id="#+id/image"
android:layout_width="match_parent"
android:layout_height="194dp"
app:srcCompat="#drawable/image_list"
app:shapeAppearanceOverlay="#style/ShapeAppearanceOverlay.App.SelectedCornerRadius"
android:scaleType="centerCrop" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_margin="16dp">
<com.google.android.material.textview.MaterialTextView
android:id="#+id/city"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?attr/textAppearanceHeadline6" />
<com.google.android.material.textview.MaterialTextView
android:id="#+id/region"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:textAppearance="?attr/textAppearanceBody2" />
<com.google.android.material.textview.MaterialTextView
android:id="#+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="2"
android:layout_marginTop="12dp"
android:textAppearance="?attr/textAppearanceBody2" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="16dp"
android:layout_gravity="center"
android:orientation="horizontal">
<com.google.android.material.button.MaterialButton
android:id="#+id/btn_check_region"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:text="#string/check_list" />
<com.google.android.material.button.MaterialButton
android:id="#+id/btn_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/check_delete" />
</LinearLayout>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
</RelativeLayout>
`
I have no idea how to fix it -.-
The ListView's height is MATCH_PARENT which constrains it to the height of its parent ViewGroup. You should always define the height of scrollable views like ListView as WRAP_CONTENT so that it can freely expand according to the number of children.
Also it might be a good idea for the parent LinearLayout to be anchored to the top of the RelativeLayout:
android:layout_alignParentTop="true".
Leaving views floating freely in RelativeLayouts may have surprising consequences.
I have a problem with the focus. Everytime I click in the EditText I can write 1 character and then it loses the focus.
I´ve searched and I found some solutions if my EditText is inside a RecyclerView, but those don´t work with my project. I suspect that this is because my EditText is inside a RecyclerView which is inside a CustomDialog.
If someone know how to solve this it would be great :D
Edit:
This is the xml code of the CustomDialog that contains the RecyclerView:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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"
android:foregroundTint="#009688">
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<EditText
android:id="#+id/nombreGasto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Nombre"
android:inputType="textPersonName"
android:minHeight="48dp" />
<EditText
android:id="#+id/precioGasto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Precio"
android:inputType="numberDecimal"
android:minHeight="48dp" />
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/recyclerGasto"
android:layout_width="match_parent"
android:layout_height="145dp" />
<Space
android:layout_width="match_parent"
android:layout_height="10dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="#+id/cancelButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:backgroundTint="#FFFFFF"
android:text="Cancel"
android:textColor="#00BCD4" />
<Button
android:id="#+id/addButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:backgroundTint="#FFFFFF"
android:text="OK"
android:textColor="#00BCD4" />
</LinearLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>
And this is the xml code of the CardView, which is the View that receives the RecyclerView, that contains the EditText:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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="wrap_content">
<androidx.cardview.widget.CardView
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<LinearLayout
android:id="#+id/linearLay"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:id="#+id/personNamePrecio"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="PersonaX"
android:textAlignment="viewStart"
android:textSize="24sp"
android:textStyle="bold" />
<EditText
android:id="#+id/editTextPrecioPersona"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="10"
android:hint="0.00"
android:inputType="numberDecimal"
android:minHeight="48dp" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>
We put requestFocus() and requestFocusFromTouch() and it works:
#personGasto is the editText
override fun afterTextChanged(p0: Editable?) {
#...
#some code
#...
personGasto.requestFocus()
personGasto.requestFocusFromTouch()
}
Hi i'm developing an app where i'm using a support ma fragment but when i try to put an edittext on map along with textview nothing is shown on map i mean the textview and editext are not visible on map i dont now where i'm going wrong so please if someone can assist me here
Here is my xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:fitsSystemWindows="true">
<LinearLayout
android:layout_above="#+id/viewpagerTop"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignParentTop="true"
android:layout_marginTop="15dp"
>
<com.ct.listrtrial.Custom.CustomTextViewMedium
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Nearby"
android:textSize="24sp"
android:textColor="#color/White"
android:layout_marginLeft="10dp"
android:layout_marginBottom="5dp"/>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableLeft="#drawable/ic_search_black_24dp"
android:background="#drawable/edit_text_shape"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"/>
</LinearLayout>
<fragment
android:id="#+id/Maps"
class="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
map:cameraTilt="30"
map:mapType="normal"
map:uiCompass="true"
map:uiRotateGestures="true"
map:uiScrollGestures="true"
map:uiTiltGestures="true"
map:uiZoomControls="false"
map:uiZoomGestures="true" />
<android.support.v4.view.ViewPager
android:id="#+id/viewPagerbackground"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="gone"/>
<View
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#B07986CB"
android:visibility="gone"/>
<android.support.v4.view.ViewPager
android:id="#+id/viewpagerTop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:paddingLeft="50dp"
android:paddingRight="50dp"
android:layout_marginTop="190dp"
android:paddingBottom="10dp"
android:layout_alignParentBottom="true" />
</RelativeLayout>
Can you try below format?
<fragment
android:id="#+id/Maps"
............ />
<LinearLayout
.............>
<CustomTextView
.......... />
<TextView
.......... />
</LinearLayout>
Other views
Try using FrameLayout instead of main RelativeLayout and also to overlap your LinearLayout with id viewpagerTop keep it below your Fragment
So, I have an activity with Image Buttons and TextViews inside of a CardView. For some reason whenever I try to open the activity within the app it takes awhile for it to open and in the console it gives me this message: Skipped 66 frames! The application may be doing too much work on its main thread. When I remove the image buttons the activity loads up normally? Does anyone know why?
`
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
>
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="#+id/card_view"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="200dp"
card_view:cardCornerRadius="4dp"
card_view:cardElevation="10dp"
>
<TextView
android:id="#+id/info_text"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Locanda La Sementa"
android:padding="8dp"
android:background="#424242"
android:textColor="#android:color/white"
android:layout_alignParentBottom="true"
android:gravity="bottom"
/>
<ImageButton
android:layout_width="match_parent"
android:layout_height="170dp"
android:src="#drawable/semanta"
android:scaleType="fitXY"
android:id="#+id/semata"
android:background="#null"
/>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="#+id/card_view2"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="200dp"
card_view:cardCornerRadius="4dp"
card_view:cardElevation="10dp"
android:layout_below="#+id/card_view"
>
<TextView
android:id="#+id/info_text3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="L’Altro Frantoio"
android:padding="8dp"
android:background="#424242"
android:textColor="#android:color/white"
android:layout_alignParentBottom="true"
android:gravity="bottom"
/>
<ImageButton
android:layout_width="match_parent"
android:layout_height="170dp"
android:src="#drawable/fran"
android:scaleType="centerCrop"
android:id="#+id/frantoio"
android:background="#null"
/>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="#+id/card_view3"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="200dp"
card_view:cardCornerRadius="4dp"
card_view:cardElevation="10dp"
android:layout_below="#+id/card_view2"
>
<TextView
android:id="#+id/info_text2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Domus Hernica"
android:padding="8dp"
android:background="#424242"
android:textColor="#android:color/white"
android:layout_alignParentBottom="true"
android:gravity="bottom"
/>
<ImageButton
android:layout_width="match_parent"
android:layout_height="170dp"
android:src="#drawable/ernica"
android:scaleType="centerCrop"
android:id="#+id/ernica"
android:background="#null"
/>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="#+id/card_view4"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="200dp"
card_view:cardCornerRadius="4dp"
card_view:cardElevation="10dp"
android:layout_below="#+id/card_view3"
>
<TextView
android:id="#+id/info_text4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Pizzeria la Ciocia"
android:padding="8dp"
android:background="#424242"
android:textColor="#android:color/white"
android:layout_alignParentBottom="true"
android:gravity="bottom"
/>
<ImageButton
android:layout_width="match_parent"
android:layout_height="170dp"
android:src="#drawable/ciocia"
android:scaleType="centerCrop"
android:id="#+id/ciocia"
android:background="#null"
/>
</android.support.v7.widget.CardView>
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="#+id/card_view6"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="200dp"
card_view:cardCornerRadius="4dp"
card_view:cardElevation="10dp"
android:layout_below="#+id/card_view4"
>
<TextView
android:id="#+id/info_text6"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="L'Aia Antica"
android:padding="8dp"
android:background="#424242"
android:textColor="#android:color/white"
android:layout_alignParentBottom="true"
android:gravity="bottom"
/>
<ImageButton
android:layout_width="match_parent"
android:layout_height="170dp"
android:src="#drawable/laia_antica"
android:scaleType="centerCrop"
android:id="#+id/antica"
android:background="#null"
/>
</android.support.v7.widget.CardView>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:height="80dp"
android:text="More"
android:textSize="17dp"
android:id="#+id/more_Button"
android:layout_below="#+id/card_view6"
android:background="#424242"
android:textColor="#android:color/white"
/>
</RelativeLayout>
</ScrollView>
`
In the ImageButtons, the images might be too large, there might be too many images or a combination of the two. The xml attribute android:src uses ImageView.setImageResource() which does the decoding on the UI thread. Notice also the an ImageButton is-a ImageView.
See also the docs.
If you aren't using your RelativeLayout to place your children relative to each other in a non linear way consider using a LinearLayout instead. A RelativeLayout requires two layout passes to layout its content.
Also, you may want to move some views into ViewStubs if they are not displayed immediately.
I have avoided this issue by not using the xml src tag but setting the imageviewers bitmap programatically.,
I am having a problem with the layout xml for my fragment... I think it may be because the layout was originally made for just an activity, and then later it was changed to a fragment. It looks like this in my editor:
But in my phone and emulator, it ends up like this:
Can anyone think of a solution for me? I've tried out multiple things but cannot seem to fix it, as i think maybe the rules are a little different when working with fragments? Thank you for all and any help!!
<?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">
<LinearLayout android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/title" />
<EditText android:id="#+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"/>
</LinearLayout>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/body" />
<EditText android:id="#+id/body" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:scrollbars="vertical" />
<Button android:id="#+id/confirm"
android:text="#string/confirm"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
Layout file for the activity:
<?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" >
<FrameLayout
android:id="#+id/frame1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/textView1"
android:layout_marginTop="130dp"
android:layout_toRightOf="#+id/textView1" >
</FrameLayout>
</LinearLayout>
Just change android:layout_width to match_parent. This will fill up all the available space horizontally.
<TextView android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/body" />
<EditText android:id="#+id/body"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:scrollbars="vertical" />
<Button android:id="#+id/confirm"
android:text="#string/confirm"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
For Layout file of activity :
<FrameLayout
android:id="#+id/frame1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/textView1"
android:layout_marginTop="130dp"
android:layout_toRightOf="#+id/textView1" >
</FrameLayout>
You can use the property "ems" to change the size.
<EditText
android:id="#+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10" >
<requestFocus />
</EditText>
for your text views and edit views try to match_parent instead of wrapping content
<TextView android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/title" />
<EditText android:id="#+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>