Including a new image view inside scroll view causing error - android

i am having a scroll view like this . There is an image view with id="#+id/but_logo_view1 inside that. I wanted to add another image view to right of that. I tried several ways. But am getting a force close error. How can I achieve the desired result. Please help
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="#+id/lineartop"
android:layout_marginBottom="50dip"
android:paddingLeft="10dip"
android:paddingRight="10dip" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center|center_horizontal"
android:orientation="vertical" >
<ImageView
android:id="#+id/but_logo_view1"
android:layout_width="60dip"
android:visibility="visible"
android:layout_height="60dip"
android:scaleType="fitXY"
android:src="#drawable/camera" />
<TableLayout
android:id="#+id/tableLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TableRow
android:id="#+id/tableRow2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginBottom="10dip"
android:gravity="center" >
<TextView
android:id="#+id/textView2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="User Name"
android:textColor="#000000"
android:textSize="18dip" />
<EditText
android:id="#+id/edit_signup_user"
android:layout_width="fill_parent"
android:layout_height="40dip"
android:maxLength="10"
android:textSize="18dip"
android:padding="3dip"
android:hint="Name"
android:singleLine="true"
android:textColor="#color/black" android:gravity="center"/>
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginBottom="10dip"
android:gravity="center" >
<TextView
android:id="#+id/textView2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="Email"
android:textColor="#000000"
android:textSize="18dip" />
<EditText
android:id="#+id/edit_signup_email"
android:layout_width="150dip"
android:layout_height="fill_parent"
android:hint="optional"
android:padding="3dip"
android:singleLine="true"
android:textSize="18dip"
android:textColor="#color/black"
android:textColorHint="#858585" android:gravity="center"/>
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginBottom="20dip"
android:gravity="center" >
<TextView
android:id="#+id/textView2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="Password"
android:textColor="#000000"
android:textSize="18dip" />
<EditText
android:id="#+id/edit_signup_passwd"
android:textSize="18dip"
android:singleLine="true"
android:inputType="number" android:maxLength="4"
android:layout_width="fill_parent"
android:layout_height="40dip"
android:textColor="#color/black"
android:padding="3dip"
/>
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginBottom="20dip"
android:gravity="center" >
<TextView
android:id="#+id/textView2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="Retype Password"
android:textColor="#000000"
android:textSize="18dip" />
<EditText
android:id="#+id/edit_signup_repasswd"
android:textSize="18dip"
android:singleLine="true"
android:inputType="number" android:maxLength="4"
android:layout_width="fill_parent"
android:layout_height="40dip"
android:textColor="#color/black"
android:padding="3dip"
/>
</TableRow>
</TableLayout>
<TableRow
android:id="#+id/tableRow1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center" >
<Button
android:id="#+id/but_signup_twitter"
android:layout_width="70dip"
android:layout_height="70dip"
android:background="#drawable/twitter_icon"
android:visibility="invisible" />
<Button
android:id="#+id/but_signup_login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/sign_in_unlit" android:typeface="serif" android:layout_marginLeft="20dip" android:layout_marginRight="20dip"/>
<Button
android:id="#+id/but_signup_fb"
android:layout_width="70dip"
android:layout_height="70dip"
android:background="#drawable/facebook_icon" />
</TableRow>
<TableRow
android:id="#+id/tableRow3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dip"
android:gravity="center|right" >
</TableRow>
</LinearLayout>
</ScrollView>

The error may be occurring because it is a LinearLayout, You could try using instead and setting the imageview like this :
<ImageView
android:id="#+id/image2"
android:layout_alignLeft="#+id/but_logo_view1"
android:layout_width="60dip"
android:visibility="visible"
android:layout_height="60dip"
android:scaleType="fitXY"/>
You can then adjust the padding or the x-axis according to how far away you want the image to be.
I hope this helps.

Not sure if the previous poster missed a word in his response, but to use 'layout_alignLeft' you need to use RelativeLayout instead of LinearLayout

Related

Unable to align checkbox(horizontally/vertically) in Android app

I need to display checkbox. All the check-boxes should align themselves at the extreme right of the screen.However, if I change the orientation of my screen the check-box comes at the middle of the screen.Please help me to solve the issue.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"
android:background="#000000"
>
<LinearLayout android:id="#+id/LinearLayout02"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center"
android:orientation="vertical"
android:layout_margin="10dp">
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#000000"
>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/sf_table"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="50dp"
android:background="#drawable/test"
>
<View android:id="#+id/Divider_7"
android:layout_height="0.5dp"
android:layout_width="fill_parent"
android:background="#808080"
android:layout_marginBottom="5dp"
/>
<TableRow
android:id="#+id/tbr6"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_margin="2dip"
android:layout_marginTop="3dp"
android:layout_marginBottom="3dp"
>
<TextView
android:textStyle="bold"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="2dp"
android:layout_marginBottom="2dp"
android:textColor="#3399CC"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Pages For Website (existing pages plus new ones you need)-Contact Us"
></TextView>
</TableRow>
<View android:id="#+id/Divider_2"
android:layout_height="1.5dp"
android:layout_width="fill_parent"
android:background="#C0C0C0"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
/>
<TableRow
android:id="#+id/tbr9"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_margin="2dip"
android:layout_marginTop="3dp"
android:layout_marginBottom="3dp"
>
<TextView
android:textStyle="bold"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="2dp"
android:layout_marginBottom="2dp"
android:textColor="#ffffff"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Feedback"
></TextView>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/feedback_id"
android:layout_gravity="right"
></CheckBox>
</TableRow>
<TableRow
android:id="#+id/tbr9"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_margin="2dip"
android:layout_marginTop="3dp"
android:layout_marginBottom="3dp"
>
<TextView
android:textStyle="bold"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="2dp"
android:layout_marginBottom="2dp"
android:textColor="#ffffff"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Tech Support"
></TextView>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/techsupport_id"
android:layout_gravity="right"
></CheckBox>
</TableRow>
<TableRow
android:id="#+id/tbr9"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_margin="2dip"
android:layout_marginTop="3dp"
android:layout_marginBottom="3dp"
>
<TextView
android:textStyle="bold"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="2dp"
android:layout_marginBottom="2dp"
android:textColor="#ffffff"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Quote Form"
></TextView>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/quoteform_id"
android:layout_gravity="right"
></CheckBox>
</TableRow>
</TableLayout>
</RelativeLayout>
</ScrollView>
</LinearLayout>
try the following
android:layout_gravity="right"
android:gravity="right"
android:layout_gravity is not relevant in a LinearLayout. It is meant for a FrameLayout. It means "what should be my gravity in relation to my (FrameLayout) father". android:gravity on the other hand means "what is the gravity inside me" and it applies to different views differently (like in a TextView it will align the text according to the gravity).
I think you could probably throw out half of the layouts you are using to display views (it's kind of confusing and hard to read) by simplifying your layout scheme and use just using a RelativeLayout for alignment issues (align to parent or to other views) and LinearLayout for grouping vertical and horizontal groups.
use tablelayout an then use tablerowlayout. and put your checkboxes.
<?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" >
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TableRow
android:id="#+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="#ffffffff"
android:text="ARE YOU CLASS 2B?" />
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="50dp"
android:layout_height="50dp" >
<RadioGroup
android:id="#+id/radioGroup" android:textColor="#000000"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<RadioButton
android:id="#+id/yes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Yes" />
<RadioButton
android:id="#+id/no"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="No" />
</RadioGroup>
</TableRow>
<TableRow
android:id="#+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<CheckBox
android:id="#+id/jimmy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Jimmy" />
</TableRow>
<TableRow
android:id="#+id/tableRow4"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<CheckBox
android:id="#+id/diana"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Diana" />
</TableRow>
<TableRow
android:id="#+id/tableRow6"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<CheckBox
android:id="#+id/dina"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Dina" />
</TableRow>
<TableRow
android:id="#+id/tableRow5"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<CheckBox
android:id="#+id/jack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Jack" />
</TableRow>
<TextView
android:id="#+id/status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
<TableRow
android:id="#+id/tableRow7"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</TableRow>
</TableLayout>
</LinearLayout>
It's example hehe

Long text in TextView

I want to display a long text in a TextView. This is my XML:
<TableLayout
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1" >
<TableRow
android:id="#+id/tableRow1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="5dip"
android:text="#string/text" />
<TextView
android:id="#+id/gender"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="right"
android:text="#string/lorem" />
</TableRow>
</TableLayout>
And this is how it looks like:
The long text doesn't fit. What do I have to change?
<TableLayout
android:layout_width="fill_parent"
android:layout_height="100dip"
android:layout_weight="1" >
<TableRow
android:id="#+id/tableRow1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:padding="5dip"
android:text="#string/text" />
<TextView
android:id="#+id/gender"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:gravity="right"
android:text="#string/lorem" />
</TableRow>
</TableLayout>
Depends on the style, that you want to achive: If Its okay to have multible-Lines you can just add in xml
android:singleLine="false"
or
android:lines="2"
If not you can allow to scroll it horizontally with
android:scrollHorizontally="true"

how can i display text below listview in android?

I have an problem to displaying text below listview.when items are more in list the below text is not appear in my emulator. how can i solve this. i have use the below code.
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/tableLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#drawable/bg1"
android:shrinkColumns="*"
android:stretchColumns="*" >
<TextView
android:id="#+id/t7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:text=""
android:textColor="#000033"
android:typeface="serif" />
<TableRow
android:id="#+id/tableRow5"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/fromstation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="#DC143C"
android:layout_gravity="left"
android:typeface="serif"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/to"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="To"
android:textColor="#000000"
android:layout_gravity="center"
android:typeface="serif"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/tostation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textColor="#DC143C"
android:layout_gravity="right"
android:typeface="serif"
android:textAppearance="?android:attr/textAppearanceMedium" />
</TableRow>
<TableRow
android:id="#+id/tableRow1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/tname"
android:layout_width="20dp"
android:layout_height="wrap_content"
android:padding="3dip"
android:text="Train"
android:layout_gravity="left"
android:textColor="#9400D3"
android:typeface="serif"
>
</TextView>
<TextView
android:id="#+id/arr"
android:layout_width="20dp"
android:layout_height="wrap_content"
android:text="Arrival"
android:layout_gravity="center"
android:textColor="#9400D3"
android:typeface="serif" >
</TextView>
<TextView
android:id="#+id/dep"
android:layout_width="20dp"
android:layout_height="wrap_content"
android:text=" Departure"
android:textColor="#9400D3"
android:layout_gravity="right"
android:typeface="serif" >
</TextView>
</TableRow>
<ListView
android:id="#id/android:list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:cacheColorHint="#00000000"
>
</ListView>
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<TextView
android:id="#+id/enq"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="*Marked services do not run on sunday."
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#800000"
android:typeface="serif" />
</LinearLayout>
</TableLayout>
can anyone tell me where i have done wrong.
thanks in advance.
Try this, android:layout_weight="1" and change layout_height="match_parent" to android:layout_height="match_parent" inside lsitview and the below layoutview
<ListView
android:id="#id/android:list"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:cacheColorHint="#00000000"
android:layout_weight="1">
</ListView>
<LinearLayout android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_marginTop="10dp">
<TextView
android:id="#+id/enq"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="*Marked services do not run on sunday."
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#800000"
android:typeface="serif" />
</LinearLayout>
P.S. For make a space of listview lager than the below layout use Proportion of android:layout_weight to 1:3(Listview 1: the belowlayout 3) or any Propotion you want
Jusy give the listview height like
android:layout_height="100dp"

table layout TextViews show text vertically vs horizontally wether they are in or out of focus

I am fairly new to eclipse and java and android dev. I have spent hours searching for an answer to this dilemma to no avail. I have a table on 3 activities of my app that consist of vertical or horizontal alteration of textViews and editText elements ie: t,e t,e t,e or tttt,eeee.
Everything looks good in eclipse i have double checked layout weight and gravity but when these activities run on emulator the text in each textView will appear vertical until i bring focus to the parent table by selecting a editText element within the same table. Once i do this the text returns to the correct horizontal fashion i originally placed it in but again reverses if focus is taken away from the table? can anyone help me?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#+id/FireScreen">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/diamondplate"
android:orientation="vertical">
<TextView
android:background="#drawable/buttonfade"
android:id="#+id/FireScreenTitle"
android:layout_alignParentTop="true"
android:layout_height="40dip"
android:layout_width="150dip"
android:textStyle="bold"
android:text="FIRE INFO"
android:textSize="21sp"
android:textColor="#FF0000"
android:gravity="center">
</TextView>
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_below="#+id/FireScreenTitle"
android:layout_height="wrap_content"
android:layout_margin="5dip"
android:id="#+id/FIfiretable">
<TableRow>
<TextView
android:id="#+id/FIfiretype"
android:text="Fire Type"
android:layout_width="0dip"
android:layout_height="40dip"
android:layout_marginBottom="5dip"
android:layout_marginRight="5dip"
android:textStyle="bold"
android:textSize="12sp"
android:textColor="#ffffff"
android:background="#drawable/buttonfade"
android:gravity="center"
android:layout_weight="1">
</TextView>
<Spinner
android:id="#+id/FItypespin"
android:layout_width="0dip"
android:layout_height="40dip"
android:layout_marginBottom="5dip"
android:layout_weight="1">
</Spinner>
</TableRow>
<TableRow>
<TextView
android:id="#+id/FIareatype"
android:text="Fire Area"
android:layout_width="0dip"
android:layout_height="40dip"
android:layout_marginBottom="5dip"
android:layout_marginRight="5dip"
android:textStyle="bold"
android:textSize="12sp"
android:textColor="#ffffff"
android:background="#drawable/buttonfade"
android:gravity="center"
android:layout_weight="1">
</TextView>
<Spinner
android:id="#+id/FIareaspin"
android:layout_width="0dip"
android:layout_height="40dip"
android:layout_marginBottom="5dip"
android:layout_weight="1">
</Spinner>
</TableRow>
<TableRow>
<TextView
android:id="#+id/FIactiontype"
android:text="Action Taken"
android:layout_width="0dip"
android:layout_height="40dip"
android:layout_marginBottom="5dip"
android:layout_marginRight="5dip"
android:textStyle="bold"
android:textSize="12sp"
android:textColor="#ffffff"
android:background="#drawable/buttonfade"
android:gravity="center"
android:layout_weight="1">
</TextView>
<Spinner
android:id="#+id/FIactionspin"
android:layout_width="0dip"
android:layout_height="40dip"
android:layout_marginBottom="5dip"
android:layout_weight="1">
</Spinner>
</TableRow>
</TableLayout>
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_below="#+id/FIfiretable"
android:layout_height="wrap_content"
android:layout_margin="5dip"
android:id="#+id/FIcalltable">
<TableRow>
<TextView
android:id="#+id/FIinvolved"
android:text="% Involved"
android:layout_width="0dip"
android:layout_height="35dip"
android:layout_marginBottom="5dip"
android:layout_marginRight="5dip"
android:textStyle="bold"
android:textSize="12sp"
android:textColor="#ffffff"
android:background="#drawable/buttonfade"
android:gravity="center"
android:layout_weight="1">
</TextView>
<TextView
android:id="#+id/FIwater"
android:text="H2O Gal."
android:layout_width="0dip"
android:layout_height="35dip"
android:layout_marginBottom="5dip"
android:textStyle="bold"
android:textColor="#ffffff"
android:background="#drawable/buttonfade"
android:gravity="center"
android:layout_weight="1"
android:textSize="12sp">
</TextView>
</TableRow>
<TableRow>
<EditText
android:text=""
android:layout_width="0dip"
android:layout_height="35dip"
android:layout_marginBottom="5dip"
android:layout_marginRight="5dip"
android:numeric="integer"
android:id="#+id/FIinvolvedtext"
android:textSize="12sp"
android:layout_weight="1">
</EditText>
<EditText
android:text=""
android:layout_width="0dip"
android:layout_height="35dip"
android:layout_marginBottom="5dip"
android:numeric="integer"
android:id="#+id/FIwatertext"
android:textSize="12sp"
android:layout_weight="1">
</EditText>
</TableRow>
<TableRow>
<TextView
android:id="#+id/FIfoam"
android:text="Foam Gal."
android:layout_width="0dip"
android:layout_height="35dip"
android:layout_marginBottom="5dip"
android:layout_marginRight="5dip"
android:textStyle="bold"
android:textColor="#ffffff"
android:background="#drawable/buttonfade"
android:gravity="center"
android:layout_weight="1"
android:textSize="12sp">
</TextView>
<TextView
android:id="#+id/FIacres"
android:text="Acres"
android:layout_width="0dip"
android:layout_height="35dip"
android:layout_marginBottom="5dip"
android:textStyle="bold"
android:textColor="#ffffff"
android:background="#drawable/buttonfade"
android:gravity="center"
android:layout_weight="1"
android:textSize="12sp">
</TextView>
</TableRow>
<TableRow>
<EditText
android:text=""
android:layout_width="0dip"
android:layout_height="35dip"
android:layout_marginBottom="5dip"
android:layout_marginRight="5dip"
android:numeric="integer"
android:id="#+id/FIfoamtext"
android:textSize="12sp"
android:layout_weight="1">
</EditText>
<EditText
android:text=""
android:layout_width="0dip"
android:layout_height="35dip"
android:layout_marginBottom="5dip"
android:numeric="integer"
android:id="#+id/FIacrestext"
android:textSize="12sp"
android:layout_weight="1">
</EditText>
</TableRow>
<TableRow>
<TextView
android:id="#+id/FIcasualties"
android:text="Casualties"
android:layout_width="0dip"
android:layout_height="35dip"
android:layout_marginRight="5dip"
android:layout_marginBottom="5dip"
android:textStyle="bold"
android:textColor="#ffffff"
android:background="#drawable/buttonfade"
android:gravity="center"
android:layout_weight="1"
android:textSize="12sp">
</TextView>
<TextView
android:id="#+id/FIfatalities"
android:text="Fatalities"
android:layout_width="0dip"
android:layout_height="35dip"
android:layout_marginBottom="5dip"
android:textStyle="bold"
android:textColor="#ffffff"
android:background="#drawable/buttonfade"
android:gravity="center"
android:layout_weight="1"
android:textSize="12sp">
</TextView>
</TableRow>
<TableRow>
<EditText
android:text=""
android:layout_width="0dip"
android:layout_height="35dip"
android:layout_marginBottom="5dip"
android:layout_marginRight="5dip"
android:numeric="integer"
android:id="#+id/FIcasualtiestext"
android:textSize="12sp"
android:layout_weight="1">
</EditText>
<EditText
android:text=""
android:layout_width="0dip"
android:layout_height="35dip"
android:layout_marginBottom="5dip"
android:numeric="integer"
android:id="#+id/FIfatalitiestext"
android:textSize="12sp"
android:layout_weight="1">
</EditText>
</TableRow>
</TableLayout>
<TextView
android:id="#+id/FInotes"
android:textColor="#ffffff"
android:background="#drawable/buttonfade"
android:layout_width="100dip"
android:textStyle="bold"
android:text="Notes"
android:layout_alignLeft="#+id/FIcalltable"
android:layout_below="#+id/FIcalltable"
android:layout_height="35dip"
android:gravity="center">
</TextView>
<EditText
android:id="#+id/FInotestext"
android:text="Additional Information:"
android:textSize="12sp"
android:layout_width="fill_parent"
android:layout_below="#+id/FInotes"
android:layout_alignLeft="#+id/FInotes"
android:layout_height="200dip"
android:gravity="top"
android:layout_marginRight="5dip"
android:layout_marginBottom="5dip"
android:inputType="textMultiLine"
android:lines="5">
</EditText>
</RelativeLayout>
</ScrollView>
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_alignParentBottom="true"
android:layout_height="50dip"
android:background="#drawable/fire_thumb"
android:id="#+id/FImenutable">
<TableRow>
<Button
android:id="#+id/FIUnitsStart"
android:background="#drawable/button2"
android:layout_width="0dip"
android:textStyle="bold"
android:textSize="15sp"
android:text="UNITS"
android:textColor="#ff0000"
android:layout_height="fill_parent"
android:gravity="center"
android:hapticFeedbackEnabled="true"
android:layout_weight="1"/>
<Button
android:id="#+id/FIMainResume"
android:background="#drawable/button2"
android:textStyle="bold"
android:textSize="15sp"
android:text="MAIN"
android:textColor="#ffffff"
android:layout_height="fill_parent"
android:gravity="center"
android:hapticFeedbackEnabled="true"
android:layout_width="0dip"
android:layout_weight="1"/>
</TableRow>
</TableLayout>
</RelativeLayout>
HAHA!!! I have figured it out! lol I had two table layouts within the same parent layout and therefore when one was given process focus over the other.... text alteration. I fixed this by placing table2 within another layout:) I.E.:
Old Way:
<LinearLayout>
<ScrollView>
<RelativeLayout>
<TableLayout1>
<TableLayout1>
<TableLayout2>
<TableLayout2>
<RelativeLayout>
<ScrollView>
<LinearLayout>
New (successful) Way:
<LinearLayout>
<ScrollView>
<RelativeLayout>
<TableLayout1>
<TableLayout1>
<LinearLayout2>
<TableLayout2>
<TableLayout2>
<LinearLayout2>
<RelativeLayout>
<ScrollView>
<LinearLayout>
Now neither TableLayout is robbing focus from the other in the same layout . . . I am not sure why I had to do this but hey it works now lol

edittext inside tablerow android

i have a textview and an edittext inside a tablerow..
my problem is when i try to write many chars in edittext then i cant see what i am writing..it seems like problem in width..Any way to make multiline row or scolling edittext while i am writting?
<TableLayout
android:id="#+id/table"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:paddingTop="30dip"
android:paddingLeft="10dip"
android:paddingRight="10dip"
android:layout_below="#id/banner" >
<TableRow>
<TextView
android:id="#+id/username_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#fff"
android:textSize="18dip"
android:text="Username"
/>
<EditText
android:id="#+id/entry1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</TableRow>
<TableRow>
<TextView
android:id="#+id/password_label"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#fff"
android:textSize="18dip"
android:text="Password" />
<EditText
android:id="#+id/entry2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:password="true" />
</TableRow>
</TableLayout>
Have you tried with android:lines/android:maxLines?
Use this its help For You.
<TableLayout android:id="#+id/table" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:stretchColumns="1"
android:layout_below="#+id/banner">
<TableRow>
<TextView android:id="#+id/username_label"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:textColor="#fff" android:textSize="18dip" android:text="Username" />
<EditText android:id="#+id/entry1" android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</TableRow>
<TableRow>
<TextView android:id="#+id/password_label"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:textColor="#fff" android:textSize="18dip" android:text="Password" />
<EditText android:id="#+id/entry2" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:password="true" />
</TableRow>
</TableLayout>

Categories

Resources