How To Create Textview & Radio Button Like This - android

I've an application where i place Radio Button & TextView on a same line . But When i run on Nexus 7 it looks like this :
I want to create to 2nd one .How can i solve this :
Here is my XML :
<?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"
>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:background="#drawable/loginsigninbackground" >
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:background="#android:color/white"
android:orientation="vertical" >
<EditText
android:id="#+id/UserNameToLogin"
android:layout_width="300dp"
android:layout_height="40dp"
android:hint="#string/username"
android:ems="10"
android:layout_gravity="center"
android:background="#drawable/customised_edit_text"
android:singleLine="true"
android:gravity="center|left"
android:textColorHint="#30D683"
android:paddingLeft="20dp"
>
<requestFocus />
</EditText>
<EditText
android:id="#+id/UserPasswordToLogin"
android:layout_width="300dp"
android:layout_height="40dp"
android:hint="#string/password"
android:ems="10"
android:inputType="textPassword"
android:layout_gravity="center"
android:background="#drawable/customised_edit_text"
android:singleLine="true"
android:gravity="center|left"
android:textColorHint="#30D683"
android:layout_marginTop="5dp"
android:paddingLeft="20dp"
>
</EditText>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<RadioButton
android:id="#+id/radioButtonRememberMe"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="#string/remember_me"
android:checked="false"
android:textSize="18sp"
android:textColor="#30D683"
android:button="#drawable/radio_selector"
android:background="#android:color/transparent" />
<TextView
android:id="#+id/UserRememberMe"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="#string/forgot_password"
android:textColor="#30D683"
android:textSize="18sp"
android:cacheColorHint="#android:color/transparent"
android:background="#android:color/transparent"
/>
</LinearLayout>
<Button
android:id="#+id/ButtonNext"
android:layout_width="match_parent"
android:layout_height="60dp"
android:text="#string/next"
android:background="#drawable/customised_button_click"
android:onClick="gotosignup"
android:clickable="true"
android:textSize="20sp"
/>
<Button
android:id="#+id/ButtonSignUp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/signup"
android:gravity="center"
android:textSize="20sp"
android:background="#drawable/customised_button_click"
android:onClick="gotosignup"
android:clickable="true"
/>
</LinearLayout>
</LinearLayout>
May I know what is the correct way to achieve my objective?Maybe this question too basic, but i did't find any suitable solution.Please Help me out.

Do not hardcode the height and width of your edit-text like you did
<EditText
android:id="#+id/UserPasswordToLogin"
android:layout_width="300dp"
android:layout_height="40dp"
android:hint="#string/password"
android:ems="10"
android:inputType="textPassword"
android:layout_gravity="center"
android:background="#drawable/customised_edit_text"
android:singleLine="true"
android:gravity="center|left"
android:textColorHint="#30D683"
android:layout_marginTop="5dp"
android:paddingLeft="20dp"
>
so basically it is
android:layout_width="300dp"
android:layout_height="40dp"
instead of give fill_parent or match_parent
android:layout_width="match_parent"
android:layout_height="match_parent"
or
android:layout_width="fill_parent"
android:layout_height="fill_parent"
do this for all text field and then try.

Try this..
There are two ways
1) Change EditText width as match_parent for both android:layout_width="match_parent"
<?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" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1" >
</RelativeLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:background="#android:color/white"
android:orientation="vertical" >
<EditText
android:id="#+id/UserNameToLogin"
android:layout_width="match_parent"
android:layout_height="40dp"
android:ems="10"
android:gravity="center|left"
android:hint="username"
android:paddingLeft="20dp"
android:singleLine="true"
android:textColorHint="#30D683" >
<requestFocus />
</EditText>
<EditText
android:id="#+id/UserPasswordToLogin"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginTop="5dp"
android:ems="10"
android:gravity="center|left"
android:hint="password"
android:inputType="textPassword"
android:paddingLeft="20dp"
android:singleLine="true"
android:textColorHint="#30D683" >
</EditText>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<RadioButton
android:id="#+id/radioButtonRememberMe"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#android:color/transparent"
android:checked="false"
android:text="remember_me"
android:textColor="#30D683"
android:textSize="18sp" />
<TextView
android:id="#+id/UserRememberMe"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#android:color/transparent"
android:cacheColorHint="#android:color/transparent"
android:text="forgot_password"
android:textColor="#30D683"
android:textSize="18sp" />
</LinearLayout>
<Button
android:id="#+id/ButtonNext"
android:layout_width="match_parent"
android:layout_height="60dp"
android:clickable="true"
android:onClick="gotosignup"
android:text="next"
android:textSize="20sp" />
<Button
android:id="#+id/ButtonSignUp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:gravity="center"
android:onClick="gotosignup"
android:text="signup"
android:textSize="20sp" />
</LinearLayout>
</LinearLayout>
and
2) change your LinearLayout width as 300dp and also remove android:layout_gravity="center" for both EditText
<LinearLayout
android:layout_width="300dp"
android:layout_height="wrap_content" >
<RadioButton
android:id="#+id/radioButtonRememberMe"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="#string/remember_me"
android:checked="false"
android:textSize="18sp"
android:textColor="#30D683"
android:button="#drawable/radio_selector"
android:background="#android:color/transparent" />
<TextView
android:id="#+id/UserRememberMe"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:text="#string/forgot_password"
android:textColor="#30D683"
android:textSize="18sp"
android:cacheColorHint="#android:color/transparent"
android:background="#android:color/transparent"
/>
</LinearLayout>

change root linearlayout as
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_horizontal"
android:orientation="vertical" >
and set layout width as 300dp in childlayout
<LinearLayout
android:layout_width="300dp"
android:layout_height="0dip"
android:layout_weight="1"
android:background="#android:color/white"
android:orientation="vertical" >

Related

Related to android layout

This is my Apps login page . problem with that is when i run app on larger screens phones it is ok with that but smaller screens are not showing my button . what is wrong with my xml. i have to use scrolls or some other solution exists. I did not use any absolute values so why i am having this problems.
<?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:weightSum=".5"
android:orientation="vertical"
android:background="#drawable/bg" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight=".1"
android:gravity="bottom|center"
android:orientation="horizontal"
android:layout_margin="8sp" >
<ImageView
android:id="#+id/imgid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/logo" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8sp"
android:layout_weight=".1"
android:gravity="bottom"
android:orientation="horizontal"
android:weightSum="5" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15sp"
android:layout_weight="1"
android:orientation="horizontal" >
<EditText
android:id="#+id/edtpinid1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/edittext_bg"
android:inputType="number"
android:maxLength="1"
android:gravity="center"
android:textColor="#222222"
android:paddingBottom="5sp"
android:paddingTop="3sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal"
android:layout_marginLeft="15sp">
<EditText
android:id="#+id/edtpinid2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/edittext_bg"
android:inputType="number"
android:maxLength="1"
android:gravity="center"
android:textColor="#222222"
android:paddingBottom="5sp"
android:paddingTop="3sp"
>
</EditText>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal"
android:layout_marginLeft="15sp">
<EditText
android:id="#+id/edtpinid3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/edittext_bg"
android:inputType="number"
android:maxLength="1"
android:gravity="center"
android:textColor="#222222"
android:paddingBottom="5sp"
android:paddingTop="3sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal"
android:layout_marginLeft="15sp">
<EditText
android:id="#+id/edtpinid4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/edittext_bg"
android:inputType="number"
android:maxLength="1"
android:gravity="center"
android:textColor="#222222"
android:paddingBottom="5sp"
android:paddingTop="3sp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="15sp"
android:layout_weight="1"
android:orientation="horizontal"
android:layout_marginLeft="15sp" >
<EditText
android:id="#+id/edtpinid5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/edittext_bg"
android:inputType="number"
android:maxLength="1"
android:gravity="center"
android:textColor="#222222"
android:paddingBottom="5sp"
android:paddingTop="3sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8sp"
android:layout_weight=".3"
android:orientation="vertical"
android:padding="12sp" >
<Button
android:id="#+id/buttonid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/button"
android:layout_marginLeft="5sp"
android:layout_marginRight="5sp"
android:text="Login"
android:textColor="#fff"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="18sp"
android:layout_marginLeft="15sp"
android:layout_marginRight="15sp"
android:weightSum="2" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
>
<TextView
android:id="#+id/txtNewUserID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New User? SignUp" /></LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right"
>
<TextView
android:id="#+id/txtforgetID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Forgot PIN?" /></LinearLayout></LinearLayout>
</LinearLayout>
</LinearLayout>
the button is not appearing on smaller screens . any on can help me out of this. what can i do to resize automatically my layout to as screen of mobile. i have to use scrolls or some other solution exists. I did not use any absolute values so why i am having this problems.
Use below code, that will work in all device, Added ScrollView for scroling issue
<?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="#drawable/bg"
android:orientation="vertical" >
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:weightSum=".5" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8sp"
android:layout_weight=".1"
android:gravity="bottom|center"
android:orientation="horizontal" >
<ImageView
android:id="#+id/imgid"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/logo" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8sp"
android:layout_weight=".1"
android:gravity="bottom"
android:orientation="horizontal"
android:weightSum="5" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15sp"
android:layout_weight="1"
android:orientation="horizontal" >
<EditText
android:id="#+id/edtpinid1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/edittext_bg"
android:gravity="center"
android:inputType="number"
android:maxLength="1"
android:paddingBottom="5sp"
android:paddingTop="3sp"
android:textColor="#222222" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15sp"
android:layout_weight="1"
android:orientation="horizontal" >
<EditText
android:id="#+id/edtpinid2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/edittext_bg"
android:gravity="center"
android:inputType="number"
android:maxLength="1"
android:paddingBottom="5sp"
android:paddingTop="3sp"
android:textColor="#222222" >
</EditText>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15sp"
android:layout_weight="1"
android:orientation="horizontal" >
<EditText
android:id="#+id/edtpinid3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/edittext_bg"
android:gravity="center"
android:inputType="number"
android:maxLength="1"
android:paddingBottom="5sp"
android:paddingTop="3sp"
android:textColor="#222222" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15sp"
android:layout_weight="1"
android:orientation="horizontal" >
<EditText
android:id="#+id/edtpinid4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/edittext_bg"
android:gravity="center"
android:inputType="number"
android:maxLength="1"
android:paddingBottom="5sp"
android:paddingTop="3sp"
android:textColor="#222222" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15sp"
android:layout_marginRight="15sp"
android:layout_weight="1"
android:orientation="horizontal" >
<EditText
android:id="#+id/edtpinid5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/edittext_bg"
android:gravity="center"
android:inputType="number"
android:maxLength="1"
android:paddingBottom="5sp"
android:paddingTop="3sp"
android:textColor="#222222" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8sp"
android:layout_weight=".3"
android:orientation="vertical"
android:padding="12sp" >
<Button
android:id="#+id/buttonid"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5sp"
android:layout_marginRight="5sp"
android:background="#drawable/button"
android:text="Login"
android:textColor="#fff" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15sp"
android:layout_marginRight="15sp"
android:layout_marginTop="18sp"
android:weightSum="2" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
<TextView
android:id="#+id/txtNewUserID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New User? SignUp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="right" >
<TextView
android:id="#+id/txtforgetID"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Forgot PIN?" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
you are using orentation verticle and weight property so u have give
android:layout_height="0dp"
insted
android:layout_height="wrap_content"
for ue child linear laouts only which are considered in verticle
hope it works for u..
use scrollView for the parent layout
Why are you using "sp" sp is more suitable for text, try using dp

Set a LinearLayout to scroll

I have been reading many posts here in stackoverflow about making a linear layout scroll and have applied all the specific advices to make it work but it still does not show on the left hand side. I am new to android and not sure what i am doing wrong.
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/scrollView1">
<LinearLayout
android:id="#+id/expense"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:gravity="start"
android:orientation="vertical"
tools:context=".Expense" >
<LinearLayout
android:id="#+id/tedsts"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="#drawable/rounded"
android:clickable="true"
android:weightSum="1.0" >
<TextView
android:id="#+id/testffg"
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight=".30"
android:text="Matter"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/tedssss"
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight=".65"
android:ellipsize="end"
android:paddingLeft="10dp"
android:singleLine="true"
android:text=""
android:textAppearance="?android:attr/textAppearanceSmall" />
<ImageView
android:layout_width="15dp"
android:layout_height="wrap_content"
android:layout_weight="0.05"
android:src="#drawable/r_arrow" />
</LinearLayout>
<TextView
android:id="#+id/tetxttx"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginLeft="0dp"
android:layout_marginRight="10dp"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#color/gray_dark"
android:visibility="invisible" />
<EditText
android:id="#+id/teetttsss"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="#drawable/rounded_all"
android:ems="10"
android:gravity="top"
android:hint="dgdfgfgf"
android:inputType="textMultiLine" />
<LinearLayout
android:id="#+id/tesssstt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="#drawable/rounded_all_clickable_selector"
android:clickable="true"
android:weightSum="1.0" >
<TextView
android:id="#+id/yttrree"
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight=".20"
android:text="Date"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/rrrefffe"
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight=".75"
android:ellipsize="end"
android:paddingLeft="10dp"
android:singleLine="true"
android:text=""
android:textAppearance="?android:attr/textAppearanceSmall" />
<ImageView
android:layout_width="15dp"
android:layout_height="wrap_content"
android:layout_weight="0.05"
android:src="#drawable/r_arrow" />
</LinearLayout>
<RadioButton
android:id="#+id/dfgrrrrr"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:layout_marginTop="5dp"
android:text="Cost"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/gergrerrr"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-4dp"
android:background="#drawable/rounded_all_clickable"
android:ems="10"
android:hint=""
android:inputType="numberDecimal"
android:singleLine="true" >
</EditText>
<RadioButton
android:id="#+id/rerreee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:layout_marginTop="5dp"
android:text="Time"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/gggrrrrre"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="#drawable/roundede"
android:ems="10"
android:hint="grrrergg."
android:inputType="numberDecimal"
android:singleLine="true"
android:visibility="gone" >
</EditText>
<EditText
android:id="#+id/65gfhhggf"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-4dp"
android:background="#drawable/rounded"
android:ems="10"
android:hint=""
android:inputType="numberDecimal" >
</EditText>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/gfhgfhtrhrth"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="50dp"
android:layout_marginTop="15dp"
android:visibility="gone" />
<TextView
android:id="#+id/ghjjhhhgh"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="30dp"
android:layout_marginTop="10dp"
android:layout_toRightOf="#+id/expense_TV_total"
android:text=""
android:textAppearance="?android:attr/textAppearanceLarge" />
<ImageButton
android:id="#+id/hgjhhghjhg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="#drawable/save_selector" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
use this :
<?xml version="1.0" encoding="utf-8"?>
<ScrollView ...>
<LinearLayout ...>
...
...
</LinearLayout>
</ScrollView>
and set hieght to
android:layout_height="wrap_content"
as Karakuri said
<?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">
//Your Main Layout
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:weightSum="100">
// First Sub Layout Under Main Layout
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:layout_weight="10"
android:weightSum="100" >
<TextView
android:id="#+id/textView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="TextView"
android:layout_weight="70" />
<EditText
android:id="#+id/editText1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="30" />
</LinearLayout>// Finishing First Sub layout
// Second Sub Layout Under Main Layout
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:layout_weight="10"
android:weightSum="100" >
<TextView
android:id="#+id/textView2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="TextView"
android:layout_weight="70" />
<EditText
android:id="#+id/editText2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="30" />
</LinearLayout>// Finishing Second Sub layout
similarly for 3rd,4rth,5th sub layouts and so on........
</LinearLayout> // Finishing Main Layout
</ScrollView> // Finishing ScrollView
Make the child of the ScrollView have android:layout_height="wrap_content" (currently yours has match_parent)
add
android:layout_width="match_parent"
android:layout_height="match_parent"
to your root ScrollView
I hope this code may be help you.
android:layout_width="match_parent"
android:layout_height="match_parent">

Setting width ratio in relative layout

Im pretty new to Android Layouts.
Im trying to set Age:EditText:Year in ratio 1:3:1 and same size on Height.
Should I use TableLayout? If yes how can i prevent TableRow1 from changing width etc when I do some stuff in other rows?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/relative_layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="#+id/txtAge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/search_text"
android:layout_alignBottom="#+id/search_text"
android:layout_alignParentLeft="true"
android:text="Age"
android:layout_weight="0.3"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="#+id/txtYears"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="#+id/search_text"
android:layout_alignBottom="#+id/search_text"
android:layout_alignParentRight="true"
android:text="Years"
android:layout_weight="0.3"
android:textAppearance="?android:attr/textAppearanceLarge" />
<EditText
android:id="#+id/search_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toLeftOf="#id/txtYears"
android:layout_toRightOf="#id/txtAge"
android:ems="10"
android:hint="Enter your age"
android:inputType="text|number"
android:lines="1"
android:layout_weight="0.7"
android:maxLength="2"
android:maxLines="1" />
<TextView
android:id="#+id/txtHeight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignBaseline="#+id/enterHeight"
android:layout_below="#+id/search_text"
android:text="Height"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_weight="1"/>
<Spinner
android:id="#+id/spinHeight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/txtHeight"
android:layout_weight="1" />
<EditText
android:id="#+id/enterHeight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/search_text"
android:layout_toLeftOf="#+id/spinHeight"
android:layout_toRightOf="#+id/txtHeight"
android:ems="10"
android:hint="Enter your height"
android:inputType="text|number"
android:lines="1"
android:layout_weight="3"
android:maxLength="3"
android:maxLines="1" >
<requestFocus />
</EditText>
</RelativeLayout>
I think this is what you want. see image below.
<?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" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="horizontal"
android:weightSum="100" >
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="20"
android:gravity="center_vertical|center_horizontal"
android:text="Age"
android:textColor="#FFF"
android:textSize="16sp"
android:textStyle="bold" />
<EditText
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="60" />
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="20"
android:gravity="center_vertical|center_horizontal"
android:text="Years"
android:textColor="#FFF"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:orientation="horizontal"
android:weightSum="100" >
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="20"
android:gravity="center_vertical|center_horizontal"
android:text="Height"
android:textColor="#FFF"
android:textSize="16sp"
android:textStyle="bold" />
<EditText
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="60" />
<Spinner
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="20" />
</LinearLayout>
</LinearLayout>
I think you should use linear layout.you can set android:weightSum="10" properties.
Its total layout. now you have to set for chilled object using android:layout_weight="2".
So that will control your object in layout.
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginLeft="5dp"
android:layout_weight="2"
android:text="Age" />
<EditText
android:id="#+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="6" >
</EditText>
<TextView
android:id="#+id/textView1"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:layout_weight="2"
android:text="Years" />
Have something like this.. Pseudo code untested..
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/relative_layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:gravity = "center_horizontal"
android:id="#+id/firstLinearLayout"
android:orientation = "horizontal"
android:weightSum="10">
<TextView
android:weight = "2"
/>
<TextView
android:weight = "6"
/>
<EditText
android:weight = "2"
/>
</LinearLayout>
<LinearLayout
android:gravity = "center_horizontal"
android:layout_below="#id/loginButtonLayout"
android:orientation = "horizontal"
android:weightSum="10">
</LinearLayout>

Gravity for Linear Layout

Can anyone help me in giving the gravity for four buttons developed in a vertical linear layout which is again in horizontal linear layout with progress bar. I need the whole buttons and the progress bar in the bottom of my screen. Please help me out.
Thanks in advance
<?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"
>
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<Button
android:id="#+id/play"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<Button
android:id="#+id/pause"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:id="#+id/back"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:id="#+id/fwd"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<ProgressBar
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="?android:attr/progressBarStyleHorizontal"
android:id="#+id/progressbar_Horizontal"
/>
</LinearLayout>
Hi # srinivas.
gravity for four buttons developed in a vertical linear layout which is again in horizontal
linear layout with progress bar, try out by this xml code.. its must helpful to you...
<?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:background="#android:color/white"
android:orientation="vertical" >
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="10dp"
android:orientation="horizontal"
android:weightSum="3" >
<TextView
android:id="#+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="First Name"
android:textColor="#000000" />
<EditText
android:id="#+id/firstName"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#android:drawable/editbox_background_normal"
android:ems="10"
android:hint="First Name"
android:maxLength="20"
android:singleLine="true"
android:textColor="#000000" >
</EditText>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="10dp"
android:orientation="horizontal"
android:weightSum="3" >
<TextView
android:id="#+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="Last Name"
android:textColor="#000000" />
<EditText
android:id="#+id/lastName"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#android:drawable/editbox_background_normal"
android:ems="10"
android:hint="Last Name"
android:maxLength="20"
android:singleLine="true"
android:textColor="#000000" >
</EditText>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="10dp"
android:orientation="horizontal"
android:weightSum="3" >
<TextView
android:id="#+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="UserName"
android:textColor="#000000" />
<EditText
android:id="#+id/un"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#android:drawable/editbox_background_normal"
android:ems="10"
android:hint="User Name"
android:maxLength="20"
android:singleLine="true"
android:textColor="#000000" >
</EditText>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="10dp"
android:orientation="horizontal"
android:weightSum="3" >
<TextView
android:id="#+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="Password"
android:textColor="#000000" />
<EditText
android:id="#+id/pw"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#android:drawable/editbox_background_normal"
android:ems="10"
android:hint="Password"
android:maxLength="20"
android:password="true"
android:singleLine="true"
android:textColor="#000000" >
</EditText>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="10dp"
android:orientation="horizontal"
android:weightSum="3" >
<TextView
android:id="#+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="Email"
android:textColor="#000000" />
<EditText
android:id="#+id/email"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#android:drawable/editbox_background_normal"
android:ems="10"
android:hint="Email"
android:maxLength="20"
android:singleLine="true"
android:textColor="#000000" >
</EditText>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="10dp"
android:orientation="horizontal"
android:weightSum="3" >
<TextView
android:id="#+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="Phone No."
android:textColor="#000000" />
<EditText
android:id="#+id/phoneNum"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#android:drawable/editbox_background_normal"
android:ems="10"
android:hint="Phone Number"
android:inputType="number"
android:maxLength="20"
android:singleLine="true"
android:textColor="#000000" >
</EditText>
</LinearLayout>
<Button
android:id="#+id/push_button"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="10dp"
android:background="#drawable/rounded_button"
android:text="Send Data"
android:textColor="#ffffff" />
</LinearLayout>
</ScrollView>
</LinearLayout>
android:gravity="bottom"
add this line to both your vertical as well as horizontal linear layout
I guess this was the answer you were looking for
Replace with following code
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout
android:id="#+id/btnLayout"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/progressbar_Horizontal"
>
<Button
android:id="#+id/play"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<Button
android:id="#+id/pause"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:id="#+id/back"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:id="#+id/fwd"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<ProgressBar
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="?android:attr/progressBarStyleHorizontal"
android:id="#+id/progressbar_Horizontal"
android:layout_alignParentBottom="true"
/>
</RelativeLayout>

Basic Scolling Question

Hey guys, im pretty new to android platform and have a really simple question. Im putting buttons as layouts with text boxes, but im running out of room. How would i make it possible for the user to scroll down to view more buttons and stuff. For example, if i have 6 buttons, and 3 are in the field of view, i wanna be able to scroll with my finger and be able to see those buttons as I scroll.
Thanks for the help guys
-Localgamer
You can put your controls(widgets: buttons, labels etc) inside a ScrollView. Check the documentation of the class for details : http://developer.android.com/reference/android/widget/ScrollView.html
Something like:
<ScrollView ..>
<TextView .../>
<Button .../>
</ScrollView>
Try this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/proffrag"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="#ffffff"
android:orientation="vertical" >
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="30dip"
android:paddingRight="30dip"
android:paddingTop="10dip" >
<EditText
android:id="#+id/firstname"
style="#style/custom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/rounded_edittext"
android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "
android:drawableLeft="#drawable/usernamem"
android:drawablePadding="10dp"
android:ems="10"
android:hint="#string/firstname"
android:inputType="textCapWords"
android:singleLine="true" >
<requestFocus />
</EditText>
<View
android:layout_width="fill_parent"
android:layout_height="10dp" />
<EditText
android:id="#+id/lastname"
style="#style/custom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/rounded_edittext"
android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "
android:drawableLeft="#drawable/usernamem"
android:drawablePadding="10dp"
android:ems="10"
android:hint="#string/lastname"
android:inputType="textCapWords"
android:singleLine="true" />
<View
android:layout_width="fill_parent"
android:layout_height="10dp" />
<EditText
android:id="#+id/username"
style="#style/custom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/rounded_edittext"
android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_#-."
android:drawableLeft="#drawable/usernamem"
android:drawablePadding="10dp"
android:ems="10"
android:hint="#string/username"
android:singleLine="true" />
<View
android:layout_width="fill_parent"
android:layout_height="10dp" />
<EditText
android:id="#+id/email"
style="#style/custom"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/rounded_edittext"
android:digits="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_#-.,"
android:drawableLeft="#drawable/emailm"
android:drawablePadding="10dp"
android:ems="10"
android:hint="#string/email"
android:inputType="textEmailAddress"
android:singleLine="true" />
<View
android:layout_width="fill_parent"
android:layout_height="10dp" />
<TextView
android:id="#+id/selecttopic"
style="#style/custom"
android:layout_width="match_parent"
android:layout_height="20dp"
android:ems="10"
android:singleLine="true"
android:text="#string/selecttopic" />
<RadioGroup
android:id="#+id/radioGroup1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/radiosubject"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/rbtn_selector"
android:button="#null"
android:gravity="center"
android:padding="5dp"
android:text="Subject"
android:textColor="#drawable/rbtn_textcolor_selector" />
<RadioButton
android:id="#+id/radiocourse"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/rbtn_selector"
android:button="#null"
android:gravity="center"
android:padding="5dp"
android:text="Courses"
android:textColor="#drawable/rbtn_textcolor_selector" />
</RadioGroup>
<View
android:layout_width="fill_parent"
android:layout_height="10dp" />
<TextView
android:id="#+id/selectgen"
style="#style/custom"
android:layout_width="match_parent"
android:layout_height="20dp"
android:ems="10"
android:singleLine="true"
android:text="#string/selectgen" />
<RadioGroup
android:id="#+id/radioGroup2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center"
android:orientation="horizontal" >
<RadioButton
android:id="#+id/radiomale"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/rbtn_selector"
android:button="#null"
android:gravity="center"
android:padding="5dp"
android:text="#string/selectmale"
android:textColor="#drawable/rbtn_textcolor_selector" />
<RadioButton
android:id="#+id/radiofemale"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/rbtn_selector"
android:button="#null"
android:gravity="center"
android:padding="5dp"
android:text="#string/selectfemale"
android:textColor="#drawable/rbtn_textcolor_selector" />
</RadioGroup>
<View
android:layout_width="fill_parent"
android:layout_height="10dp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/proftextgender"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true" />
<Button
android:id="#+id/browse"
style="?android:attr/buttonStyleSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:background="#drawable/mycustom_button"
android:minHeight="40dp"
android:text="#string/browse"
android:textColor="#ffffff" />
</RelativeLayout>
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="10dp" />
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="50dp"
android:orientation="horizontal"
android:paddingLeft="10dp"
android:paddingRight="10dp" >
<LinearLayout
android:id="#+id/firs"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:orientation="horizontal"
android:paddingLeft="20dp" >
<TextView
android:id="#+id/browseimage"
android:layout_width="109dp"
android:layout_height="wrap_content"
android:layout_weight="1.17"
android:maxLines="2" />
</LinearLayout>
<View
android:id="#+id/vi"
android:layout_width="20dp"
android:layout_height="fill_parent"
android:layout_toRightOf="#id/firs" >
</View>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toRightOf="#id/vi"
android:layout_weight="1"
android:orientation="horizontal" >
<Button
android:id="#+id/upload"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/mycustom_button"
android:minHeight="30dp"
android:paddingLeft="20dp"
android:paddingRight="20dp"
android:text="#string/upload"
android:textColor="#ffffff" />
</LinearLayout>
</RelativeLayout>
<View
android:layout_width="fill_parent"
android:layout_height="5dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center_horizontal"
android:orientation="horizontal" >
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:paddingLeft="30dp"
android:paddingRight="30dp" >
<Button
android:id="#+id/savechagnes"
style="?android:attr/buttonStyleSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/mycustom_button"
android:minHeight="40dp"
android:text="#string/savechanges"
android:textColor="#ffffff" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="5dp" />
</LinearLayout>
</ScrollView>
</LinearLayout>

Categories

Resources