I have created a TableLayout where I want each row to have the same height, regardless of it's content.
How can I do this?
Here is my code. Each row element get the same width, but the heights are not equal. What am I doing wrong?
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" android:background="#color/grey"
android:padding="1dip" >
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#color/grey" >
<LinearLayout
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#color/white"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center_vertical"
android:layout_marginBottom="5dip"
android:layout_marginTop="2dip"
android:layout_weight="1"
android:background="#color/white"
android:gravity="center_horizontal"
android:text="#string/car_make"
android:textStyle="bold" />
<TextView
android:id="#+id/carMake"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center_vertical"
android:layout_marginLeft="1dip"
android:layout_weight="1"
android:background="#color/white"
android:gravity="center_horizontal"
android:text="#string/car_detail" />
</LinearLayout>
<LinearLayout
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#color/white"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center_vertical"
android:layout_marginBottom="5dip"
android:layout_marginTop="2dip"
android:layout_weight="1"
android:background="#color/white"
android:gravity="center_horizontal"
android:text="#string/car_model"
android:textStyle="bold" />
<TextView
android:id="#+id/carModel"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:background="#color/white"
android:gravity="center_horizontal"
android:text="#string/car_detail" />
</LinearLayout>
<LinearLayout
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#color/white"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center_vertical"
android:layout_marginBottom="5dip"
android:layout_marginTop="2dip"
android:layout_weight="1"
android:background="#color/white"
android:gravity="center_horizontal"
android:text="#string/car_version"
android:textStyle="bold" />
<TextView
android:id="#+id/carYear"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:background="#color/white"
android:gravity="center_horizontal"
android:text="#string/car_year" />
</LinearLayout>
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginTop="1dip"
android:layout_weight="1"
android:background="#color/grey" >
<LinearLayout
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#color/white"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginBottom="5dip"
android:layout_marginTop="2dip"
android:background="#color/white"
android:gravity="center_horizontal"
android:text="#string/car_year"
android:textStyle="bold" />
<TextView
android:id="#+id/carYear"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="#color/white"
android:gravity="center_horizontal"
android:text="#string/car_year" />
</LinearLayout>
<LinearLayout
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#color/white"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginBottom="5dip"
android:layout_marginTop="2dip"
android:background="#color/white"
android:gravity="center_horizontal"
android:text="#string/car_mileage"
android:textStyle="bold" />
<TextView
android:id="#+id/carYear"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="#color/white"
android:gravity="center_horizontal"
android:text="#string/car_year" />
</LinearLayout>
<LinearLayout
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#color/white"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginBottom="5dip"
android:layout_marginTop="2dip"
android:background="#color/white"
android:gravity="center_horizontal"
android:text="#string/car_engine_capacity"
android:textStyle="bold" />
<TextView
android:id="#+id/carYear"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center_vertical"
android:background="#color/white"
android:gravity="center_horizontal"
android:text="#string/car_year" />
</LinearLayout>
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginTop="1dip"
android:layout_weight="1"
android:background="#color/grey" >
<LinearLayout
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#color/white"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginBottom="5dip"
android:background="#color/white"
android:gravity="center_horizontal"
android:text="#string/car_engine_type"
android:textStyle="bold" />
<TextView
android:id="#+id/carYear"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="#color/white"
android:gravity="center_horizontal"
android:text="#string/car_year" />
</LinearLayout>
<LinearLayout
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#color/white"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginBottom="5dip"
android:background="#color/white"
android:gravity="center_horizontal"
android:text="#string/car_exterior_color"
android:textStyle="bold" />
<TextView
android:id="#+id/carYear"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="#color/white"
android:gravity="center_horizontal"
android:text="#string/car_year" />
</LinearLayout>
<LinearLayout
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#color/white"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginBottom="5dip"
android:background="#color/white"
android:gravity="center_horizontal"
android:text="#string/car_city"
android:textStyle="bold" />
<TextView
android:id="#+id/carYear"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="#color/white"
android:gravity="center_horizontal"
android:text="#string/car_year" />
</LinearLayout>
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginTop="1dip"
android:layout_weight="1"
android:background="#color/grey" >
<LinearLayout
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#color/white"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginBottom="5dip"
android:background="#color/white"
android:gravity="center_horizontal"
android:text="#string/car_transmittion"
android:textStyle="bold" />
<TextView
android:id="#+id/carYear"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="#color/white"
android:gravity="center_horizontal"
android:text="#string/car_year" />
</LinearLayout>
<LinearLayout
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#color/white"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginBottom="5dip"
android:background="#color/white"
android:gravity="center_horizontal"
android:text="#string/car_area"
android:textStyle="bold" />
<TextView
android:id="#+id/carYear"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="#color/white"
android:gravity="center_horizontal"
android:text="#string/car_year" />
</LinearLayout>
<LinearLayout
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#color/white"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginBottom="5dip"
android:background="#color/white"
android:gravity="center_horizontal"
android:text="#string/car_registered_city"
android:textStyle="bold" />
<TextView
android:id="#+id/carYear"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="#color/white"
android:gravity="center_horizontal"
android:text="#string/car_year" />
</LinearLayout>
</TableRow>
</TableLayout>
Introduced in API 11, you can set android:measureWithLargestChild="true" on the TableLayout and android:layout_weight="1" on each TableRow.
here is your solution :
<?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" >
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:weightSum="4" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginRight="1dp"
android:layout_weight="1"
android:background="#B0B0B0" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginRight="1dp"
android:layout_weight="1"
android:background="#B0B0B0" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginRight="1dp"
android:layout_weight="1"
android:background="#B0B0B0" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#B0B0B0" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="1dp"
android:orientation="vertical"
android:weightSum="4" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginRight="1dp"
android:layout_weight="1"
android:background="#B0B0B0" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginRight="1dp"
android:layout_weight="1"
android:background="#B0B0B0" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginRight="1dp"
android:layout_weight="1"
android:background="#B0B0B0" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#B0B0B0" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="1dp"
android:orientation="vertical"
android:weightSum="4" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginRight="1dp"
android:layout_weight="1"
android:background="#B0B0B0" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginRight="1dp"
android:layout_weight="1"
android:background="#B0B0B0" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginRight="1dp"
android:layout_weight="1"
android:background="#B0B0B0" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#B0B0B0" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="1dp"
android:orientation="vertical"
android:weightSum="4" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginRight="1dp"
android:layout_weight="1"
android:background="#B0B0B0" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginRight="1dp"
android:layout_weight="1"
android:background="#B0B0B0" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginRight="1dp"
android:layout_weight="1"
android:background="#B0B0B0" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#B0B0B0" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="1dp"
android:orientation="vertical"
android:weightSum="4" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginRight="1dp"
android:layout_weight="1"
android:background="#B0B0B0" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginRight="1dp"
android:layout_weight="1"
android:background="#B0B0B0" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginRight="1dp"
android:layout_weight="1"
android:background="#B0B0B0" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#B0B0B0" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="1dp"
android:orientation="vertical"
android:weightSum="4" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginRight="1dp"
android:layout_weight="1"
android:background="#B0B0B0" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginRight="1dp"
android:layout_weight="1"
android:background="#B0B0B0" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginRight="1dp"
android:layout_weight="1"
android:background="#B0B0B0" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#B0B0B0" />
</TableRow>
</TableLayout>
</LinearLayout>
here is a solution:
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_gravity="fill"
/>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_gravity="fill"
/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_gravity="fill"
/>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:layout_gravity="fill"
/>
</TableRow>
I just came across this issue and solved it.
It turns out Sunny's answer worked for me.
Though as mentioned in the comment, I could figure out if it works by just reading it. I am a newbee so cannot neither leave comment nor vote it to useful. Therefore I am posting it here.
The idea is that you let TableRow to decide the height of the row. By setting layout_height to wrap_content, the height of the row is depends on the contents which is TextView.
Since the border line of the cell would be the boundary of TextView, the layout_height should be match_parent.
I wish it is helpful for Android newbee (yes i am new to android too).
<TableRow
android:layout_width="fill_parent"
android:layout_height="xxdip" // HERE define a fixed size
Below Answer Deprecated Now :
You can Change in your TableRow -> LinearLayout
<LinearLayout
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#color/white"
android:orientation="vertical" >
Related
Top text "Your profile" is not visible in my layout.
In album orientation pictures are truncated.
I have added "Scroll" element, but it does not work there.
My XML is below:
<?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="#color/backNormal"
android:orientation="vertical"
>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#color/backNormal"
android:orientation="vertical"
>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#color/backNormal"
android:orientation="vertical"
android:layout_gravity="center_horizontal|center_vertical"
>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#color/backNormal"
android:orientation="horizontal"
android:layout_gravity="center_horizontal|center_vertical"
android:weightSum="6"
>
<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="#color/backNormal"
android:orientation="vertical"
android:layout_weight="4"
android:layout_gravity="center_horizontal|center_vertical"
>
<TextView
android:id="#+id/driverProfileTextTitle"
android:gravity="center"
android:text='Your profile'
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
style="#style/text_style_title"
/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<ImageView
android:id="#+id/driverProfileImageFace"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_weight="1"
android:src="#drawable/driver"
android:adjustViewBounds="true"
/>
<ImageView
android:id="#+id/driverProfileImageCar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_weight="1"
android:src="#drawable/car"
android:adjustViewBounds="true"
/>
</LinearLayout>
<TextView
android:id="#+id/driverProfileTextName"
android:gravity="center"
android:text='Your name'
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
style="#style/text_style_normal"
/>
<EditText
android:id="#+id/driverProfileEditName"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:lines="1"
android:minLines="1"
android:maxLines="1"
android:maxLength="25"
style="#style/edit_style"
android:layout_gravity="left"
android:background="#drawable/edit"
android:inputType="textCapSentences"
android:cursorVisible="true"
/>
<TextView
android:id="#+id/driverProfileTextCar"
android:gravity="center"
android:text='Car model and number'
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
style="#style/text_style_normal"
/>
<EditText
android:id="#+id/driverProfileEditCar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:lines="1"
android:minLines="1"
android:maxLines="1"
android:maxLength="25"
style="#style/edit_style"
android:layout_gravity="left"
android:background="#drawable/edit"
android:inputType="textCapSentences"
android:cursorVisible="true"
/>
<TextView
android:id="#+id/driverProfileTextGenderTitle"
android:gravity="center"
android:text='Gender'
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
style="#style/text_style_normal"
/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center"
android:weightSum="4"
>
<Button
android:id="#+id/driverProfileButtonMale"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text='M'
style="#style/button_style_normal"
/>
<TextView
android:id="#+id/driverProfileTextGender"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="2"
android:gravity="center"
android:text='Unknown'
android:background="#color/backDark1"
style="#style/text_style_normal"
/>
<Button
android:id="#+id/driverProfileButtonFemale"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="fill_parent"
android:text='F'
style="#style/button_style_normal"
/>
</LinearLayout>
<TextView
android:id="#+id/driverProfileTextYearTitle"
android:gravity="center"
android:text='Year Of Birth'
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
style="#style/text_style_normal"
/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center"
android:weightSum="4"
>
<Button
android:id="#+id/driverProfileButtonYearMinus"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text='-'
style="#style/button_style_normal"
/>
<TextView
android:id="#+id/driverProfileTextYear"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="2"
android:gravity="center"
android:text='Unknown'
android:background="#color/backDark1"
style="#style/text_style_normal"
/>
<Button
android:id="#+id/driverProfileButtonYearPlus"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="fill_parent"
android:text='+'
style="#style/button_style_normal"
/>
</LinearLayout>
<ProgressBar
android:id="#+id/driverProfileProgress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
/>
<Button
android:id="#+id/driverProfileButtonReg"
android:text='Registration'
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
style="#style/button_style_normal"
/>
<TextView
android:id="#+id/driverProfileTextResult"
android:gravity="center"
android:text=''
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="#style/text_style_normal"
/>
</LinearLayout>
<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginBottom="5dp"
/>
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
Any ideas please?
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#color/backNormal"
android:orientation="vertical"
android:fillViewport="true" >
Rest of the code
Use ScrollView as a parent.
I think this can help you.
Try this:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginBottom="8dp"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#color/backNormal"
android:layout_gravity="center_horizontal|center_vertical"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center_horizontal|center_vertical"
android:weightSum="6"
>
<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="4"
android:layout_gravity="center_horizontal|center_vertical"
>
<TextView
android:id="#+id/driverProfileTextTitle"
android:gravity="center"
android:text='Your profile'
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
style="#style/text_style_title"
/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<ImageView
android:id="#+id/driverProfileImageFace"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_weight="1"
android:src="#drawable/driver"
android:adjustViewBounds="true"
/>
<ImageView
android:id="#+id/driverProfileImageCar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_weight="1"
android:src="#drawable/car"
android:adjustViewBounds="true"
/>
</LinearLayout>
<TextView
android:id="#+id/driverProfileTextName"
android:gravity="center"
android:text='Your name'
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
style="#style/text_style_normal"
/>
<EditText
android:id="#+id/driverProfileEditName"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:lines="1"
android:minLines="1"
android:maxLines="1"
android:maxLength="25"
style="#style/edit_style"
android:layout_gravity="left"
android:background="#drawable/edit"
android:inputType="textCapSentences"
android:cursorVisible="true"
/>
<TextView
android:id="#+id/driverProfileTextCar"
android:gravity="center"
android:text='Car model and number'
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
style="#style/text_style_normal"
/>
<EditText
android:id="#+id/driverProfileEditCar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:lines="1"
android:minLines="1"
android:maxLines="1"
android:maxLength="25"
style="#style/edit_style"
android:layout_gravity="left"
android:background="#drawable/edit"
android:inputType="textCapSentences"
android:cursorVisible="true"
/>
<TextView
android:id="#+id/driverProfileTextGenderTitle"
android:gravity="center"
android:text='Gender'
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
style="#style/text_style_normal"
/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center"
android:weightSum="4"
>
<Button
android:id="#+id/driverProfileButtonMale"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text='M'
style="#style/button_style_normal"
/>
<TextView
android:id="#+id/driverProfileTextGender"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="2"
android:gravity="center"
android:text='Unknown'
android:background="#color/backDark1"
style="#style/text_style_normal"
/>
<Button
android:id="#+id/driverProfileButtonFemale"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="fill_parent"
android:text='F'
style="#style/button_style_normal"
/>
</LinearLayout>
<TextView
android:id="#+id/driverProfileTextYearTitle"
android:gravity="center"
android:text='Year Of Birth'
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
style="#style/text_style_normal"
/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="center"
android:weightSum="4"
>
<Button
android:id="#+id/driverProfileButtonYearMinus"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text='-'
style="#style/button_style_normal"
/>
<TextView
android:id="#+id/driverProfileTextYear"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="2"
android:gravity="center"
android:text='Unknown'
android:background="#color/backDark1"
style="#style/text_style_normal"
/>
<Button
android:id="#+id/driverProfileButtonYearPlus"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="fill_parent"
android:text='+'
style="#style/button_style_normal"
/>
</LinearLayout>
<ProgressBar
android:id="#+id/driverProfileProgress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
/>
<Button
android:id="#+id/driverProfileButtonReg"
android:text='Registration'
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
style="#style/button_style_normal"
/>
<TextView
android:id="#+id/driverProfileTextResult"
android:gravity="center"
android:text=''
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="#style/text_style_normal"
/>
</LinearLayout>
<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginBottom="5dp"
/>
</LinearLayout>
</LinearLayout>
</ScrollView>
but you need improve your layout with more RelativeLayout instead of LinearLayout, and also deep layout level will reduce performance
Use android:fillViewport="true" in your ScrollView and it will fill up the screen.
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true" >
Try this
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#color/backNormal"
android:orientation="vertical" >
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:background="#color/backNormal"
android:orientation="vertical" >
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:background="#color/backNormal"
android:orientation="horizontal"
android:weightSum="6" >
<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_weight="4"
android:background="#color/backNormal"
android:orientation="vertical" >
<TextView
android:id="#+id/driverProfileTextTitle"
style="#style/text_style_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center"
android:text="Your profile" />
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<ImageView
android:id="#+id/driverProfileImageFace"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:adjustViewBounds="true"
android:src="#drawable/driver" />
<ImageView
android:id="#+id/driverProfileImageCar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:layout_weight="1"
android:adjustViewBounds="true"
android:src="#drawable/car" />
</LinearLayout>
<TextView
android:id="#+id/driverProfileTextName"
style="#style/text_style_normal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center"
android:text="Your name" />
<EditText
android:id="#+id/driverProfileEditName"
style="#style/edit_style"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:background="#drawable/edit"
android:cursorVisible="true"
android:inputType="textCapSentences"
android:lines="1"
android:maxLength="25"
android:maxLines="1"
android:minLines="1" />
<TextView
android:id="#+id/driverProfileTextCar"
style="#style/text_style_normal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center"
android:text="Car model and number" />
<EditText
android:id="#+id/driverProfileEditCar"
style="#style/edit_style"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:background="#drawable/edit"
android:cursorVisible="true"
android:inputType="textCapSentences"
android:lines="1"
android:maxLength="25"
android:maxLines="1"
android:minLines="1" />
<TextView
android:id="#+id/driverProfileTextGenderTitle"
style="#style/text_style_normal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center"
android:text="Gender" />
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal"
android:weightSum="4" >
<Button
android:id="#+id/driverProfileButtonMale"
style="#style/button_style_normal"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="M" />
<TextView
android:id="#+id/driverProfileTextGender"
style="#style/text_style_normal"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="2"
android:background="#color/backDark1"
android:gravity="center"
android:text="Unknown" />
<Button
android:id="#+id/driverProfileButtonFemale"
style="#style/button_style_normal"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="F" />
</LinearLayout>
<TextView
android:id="#+id/driverProfileTextYearTitle"
style="#style/text_style_normal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center"
android:text="Year Of Birth" />
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal"
android:weightSum="4" >
<Button
android:id="#+id/driverProfileButtonYearMinus"
style="#style/button_style_normal"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="-" />
<TextView
android:id="#+id/driverProfileTextYear"
style="#style/text_style_normal"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="2"
android:background="#color/backDark1"
android:gravity="center"
android:text="Unknown" />
<Button
android:id="#+id/driverProfileButtonYearPlus"
style="#style/button_style_normal"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:text="+" />
</LinearLayout>
<ProgressBar
android:id="#+id/driverProfileProgress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal" />
<Button
android:id="#+id/driverProfileButtonReg"
style="#style/button_style_normal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:text="Registration" />
<TextView
android:id="#+id/driverProfileTextResult"
style="#style/text_style_normal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="" />
</LinearLayout>
<View
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
</ScrollView>
I don't have enough reputation to comment, but using ScrollView as parent and android:fillViewport="true" should solve your issue. If it is not specify whether you are able Scroll after adding ScrollView as parent.
When I have an application filled with text, when I scroll down to see the end of the text, it must show me a background at the end .. I wrote this but it shows the background in the middle - I think
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/bglow"
android:layout_alignParentBottom="true"
android:layout_marginBottom="0dip"
android:gravity="bottom" />
How can I put a background at the end?
Edited
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFFFFF"
android:gravity="center" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/bglow"
android:layout_alignParentBottom="true"
android:layout_marginBottom="0dip"
android:gravity="bottom" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:gravity="center"
android:orientation="vertical"
android:textStyle="italic" >
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:text=""
android:textSize="7sp" />
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:src="#drawable/1" />
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:text=""
android:textSize="15sp" />
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:src="#drawable/logoline" />
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:text=""
android:textSize="5sp" />
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:gravity="center_vertical"
android:orientation="horizontal"
android:textStyle="italic"
android:weightSum="100" >
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="60"
android:gravity="center"
android:src="#drawable/2" />
<Button
android:id="#+id/h"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="40"
android:background="#drawable/buttoncolor"
android:gravity="left"
android:text="H"
android:textColor="#AD9C64"
android:textSize="25sp"
android:textStyle="italic"
android:typeface="serif" />
</LinearLayout>
</ScrollView>
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:text=""
android:textSize="15sp" />
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:gravity="center_vertical"
android:orientation="horizontal"
android:textStyle="italic"
android:weightSum="100" >
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="60"
android:gravity="center"
android:src="#drawable/3" />
<Button
android:id="#+id/r"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="40"
android:background="#drawable/buttoncolor"
android:gravity="left"
android:text="R"
android:textColor="#AD9C64"
android:textSize="25sp"
android:textStyle="italic"
android:typeface="serif" />
</LinearLayout>
</ScrollView>
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:text=""
android:textSize="15sp" />
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:gravity="center_vertical"
android:orientation="horizontal"
android:textStyle="italic"
android:weightSum="100" >
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="60"
android:gravity="center"
android:src="#drawable/4" />
<Button
android:id="#+id/4"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="40"
android:background="#drawable/buttoncolor"
android:gravity="left"
android:text="D"
android:textColor="#AD9C64"
android:textSize="22sp"
android:textStyle="italic"
android:typeface="serif" />
</LinearLayout>
</ScrollView>
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:text=""
android:textSize="7sp" />
<Button
android:id="#+id/ab"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/buttoncolor"
android:gravity="center"
android:text="About"
android:textColor="#AD9C64"
android:textSize="10sp"
android:textStyle="italic"
android:typeface="serif" />
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:text=""
android:textSize="7sp" />
</LinearLayout>
</ScrollView>
</LinearLayout>
</RelativeLayout>
I have this code:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/LinearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/fondo"
android:gravity="center_horizontal"
android:orientation="vertical"
tools:context=".Inicio" >
<ViewFlipper
android:id="#+id/flipper1"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_margin="40dp"
android:layout_weight="1"
android:fillViewport="true" >
<ImageView
android:id="#+id/rotacion1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:contentDescription="#string/img_desc"
android:scaleType="fitXY"
android:src="#drawable/rotacion1" />
<ImageView
android:id="#+id/rotacion2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:contentDescription="#string/img_desc"
android:scaleType="fitXY"
android:src="#drawable/rotacion2" />
</ViewFlipper>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="100dp"
android:gravity="center_vertical|center_horizontal"
android:orientation="horizontal"
android:paddingTop="1dp" >
<TextView
android:id="#+id/textBienve"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#30c2c2c2"
android:clickable="true"
android:drawablePadding="5dp"
android:drawableTop="#drawable/ic_bienvel"
android:gravity="center_horizontal"
android:onClick="menu1"
android:text="#string/menu1"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#fff" />
<TextView
android:id="#+id/textMenudia"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="bottom"
android:layout_marginLeft="1dp"
android:layout_weight="1"
android:background="#30c2c2c2"
android:clickable="true"
android:drawablePadding="5dp"
android:drawableTop="#drawable/ic_menu"
android:gravity="center_horizontal"
android:onClick="menu2"
android:text="#string/menu2"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#fff" />
<TextView
android:id="#+id/textEspeciali"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="bottom"
android:layout_marginLeft="1dp"
android:layout_weight="1"
android:background="#30c2c2c2"
android:clickable="true"
android:drawablePadding="5dp"
android:drawableTop="#drawable/ic_espec"
android:gravity="center_horizontal"
android:onClick="menu3"
android:text="#string/especialidades"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#fff" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="100dp"
android:gravity="center_vertical|center_horizontal"
android:orientation="horizontal"
android:paddingBottom="1dp"
android:paddingTop="1dp" >
<TextView
android:id="#+id/textCeleb"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="#30c2c2c2"
android:clickable="true"
android:drawablePadding="5dp"
android:drawableTop="#drawable/ic_celeb"
android:gravity="center_horizontal"
android:onClick="menu4"
android:text="#string/menu4"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#fff" />
<TextView
android:id="#+id/textProvee"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="bottom"
android:layout_marginLeft="1dp"
android:layout_weight="1"
android:background="#30c2c2c2"
android:clickable="true"
android:drawablePadding="5dp"
android:drawableTop="#drawable/ic_prove"
android:gravity="center_horizontal"
android:onClick="menu5"
android:text="#string/menu5"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#fff" />
<TextView
android:id="#+id/textLocalic"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="bottom"
android:layout_marginLeft="1dp"
android:layout_weight="1"
android:background="#30c2c2c2"
android:clickable="true"
android:drawablePadding="5dp"
android:drawableTop="#drawable/ic_local"
android:gravity="center_horizontal"
android:onClick="menu6"
android:text="#string/menu6"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#fff" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView
android:id="#+id/ImageView01"
android:layout_width="0dp"
android:layout_height="55dp"
android:layout_weight="1"
android:contentDescription="#string/fondo"
android:src="#drawable/iconossocialesf" />
<TextView
android:id="#+id/textView1"
android:layout_width="0dp"
android:layout_height="55dp"
android:layout_weight="1"
android:background="#30c2c2c2"
android:gravity="center_vertical|center_horizontal"
android:onClick="mostrardialog"
android:text="#string/contacto"
android:textAppearance="?android:attr/textAppearanceMedium" />
<ImageView
android:id="#+id/imageView2"
android:layout_width="0dp"
android:layout_height="55dp"
android:layout_weight="1"
android:contentDescription="#string/fondo"
android:src="#drawable/iconossocialest" />
</LinearLayout>
i need that the viewflipper go fluid, but this is not even shown and not adjust to my screen.if I put a size such 200DP all my layouts go down or up according to the screen size, i only want to adjust all the layouts to max screen size.
what I do wrong?
I have a problem with dividing the LinearLayout(Horizontal) into three columns (vertical columns).
Can someone look into the XML and advise ?
XML below:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="100" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="40"
android:orientation="vertical" >
<ImageButton
android:id="#+id/ibTakeCheckPhoto"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_weight="1"
android:src="#drawable/camera" />
</LinearLayout>
<View
android:layout_width="2dp"
android:layout_height="fill_parent"
android:background="#android:color/darker_gray" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="30"
android:orientation="vertical" >
<TextView
android:id="#+id/checkLayoutIDTV"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Check Number"
android:textStyle="bold" />
<TextView
android:id="#+id/checkLayout_amountTV"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Amount"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="30"
android:orientation="vertical" >
<EditText
android:id="#+id/checkLayoutIDET"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="Check No."
android:inputType="number" >
</EditText>
<EditText
android:id="#+id/checkLayout_amounET"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="5"
android:hint="Amount"
android:inputType="number" />
</LinearLayout>
<?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="wrap_content"
android:orientation="horizontal"
android:weightSum="100" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="24.33"
android:orientation="vertical" >
<TableLayout
android:layout_width="wrap_content"
android:layout_height="match_parent" >
<TableRow
android:id="#+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/checkLayoutIDTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Check Number"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textStyle="bold" />
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/checkLayout_amountTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Amount"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textStyle="bold" />
</TableRow>
</TableLayout>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="vertical" >
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TableRow
android:id="#+id/tableRow6"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<EditText
android:id="#+id/EditText01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="5"
android:hint="Amount"
android:inputType="number" />
</TableRow>
<TableRow
android:id="#+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<EditText
android:id="#+id/checkLayoutIDET"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="edit2"
android:inputType="number" />
</TableRow>
<TableRow
android:id="#+id/tableRow4"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<EditText
android:id="#+id/checkLayout_amounET"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="5"
android:hint="Amount"
android:inputType="number" >
<requestFocus />
</EditText>
</TableRow>
</TableLayout>
</LinearLayout>
</LinearLayout>
may b it fulfill your requirement..
Use android:layout_width="fill_parent" instead of android:layout_width="0dp" in ImageButton, TextView and EditText.
Resulting layout will look like this
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="100" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="40"
android:orientation="vertical" >
<ImageButton
android:id="#+id/ibTakeCheckPhoto"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="left"
android:src="#drawable/camera" />
</LinearLayout>
<View
android:layout_width="2dp"
android:layout_height="fill_parent"
android:background="#android:color/darker_gray" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="30"
android:orientation="vertical" >
<TextView
android:id="#+id/checkLayoutIDTV"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:text="Check Number"
android:textStyle="bold" />
<TextView
android:id="#+id/checkLayout_amountTV"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:text="Amount"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="30"
android:orientation="vertical" >
<EditText
android:id="#+id/checkLayoutIDET"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="Check No."
android:inputType="number" >
</EditText>
<EditText
android:id="#+id/checkLayout_amounET"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="5"
android:hint="Amount"
android:inputType="number" />
</LinearLayout>
</LinearLayout>
And extract hardcoded strings to res/values/strings.xml
i think this is what you wanted
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="10" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="4"
android:orientation="vertical" >
<ImageButton
android:id="#+id/ibTakeCheckPhoto"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="left"
android:layout_weight="1"
android:src="#drawable/ic_launcher" />
</LinearLayout>
<View
android:layout_width="2dp"
android:layout_height="fill_parent"
android:background="#android:color/darker_gray" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:orientation="vertical" >
<TextView
android:id="#+id/checkLayoutIDTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Check Number"
android:textStyle="bold" />
<TextView
android:id="#+id/checkLayout_amountTV"
android:layout_width="60dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Amount"
android:textStyle="bold" />
</LinearLayout>
<View
android:layout_width="2dp"
android:layout_height="fill_parent"
android:background="#android:color/darker_gray" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:orientation="vertical" >
<EditText
android:id="#+id/checkLayoutIDET"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="Check No."
android:inputType="number" >
</EditText>
<EditText
android:id="#+id/checkLayout_amounET"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ems="5"
android:hint="Amount"
android:inputType="number" />
</LinearLayout>
I have this xml layout code:
<?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:gravity="center_horizontal"
android:background="#FFFFFF">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/nektaText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="10pt"
android:textAlignment="center"
android:text="example text will not be used" />
<ImageView
android:id="#+id/horilinee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:src="#drawable/horiline" />
<TableRow
android:id="#+id/table"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="bottom" >
<Button
android:id="#+id/send"
android:text="أرسل"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
<EditText
android:id="#+id/commenttext"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="اكتب التعليق هنا"
android:minLines="1"
android:paddingRight="5dp"
android:paddingLeft="5dp"
android:scrollHorizontally="true"
android:scrollbars="vertical"
android:layout_weight="1"
android:singleLine="false" />
</TableRow>
<ImageView
android:id="#+id/horilineee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:src="#drawable/horiline" />
<ListView
android:id="#id/android:list"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:drawSelectorOnTop="false"
android:paddingLeft="5dp"
android:paddingRight="5dp" />
</TableLayout>
</ScrollView>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:gravity="center_horizontal" >
<TableLayout
android:id="#+id/tableLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TableRow
android:id="#+id/tableRow0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="bottom"
android:paddingBottom="10dp"
android:paddingTop="10dp" >
<ImageView
android:id="#+id/horiline"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="#drawable/horiline" />
</TableRow>
<TableRow
android:id="#+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="bottom" >
<ImageView
android:id="#+id/share"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:src="#drawable/share" />
<ImageView
android:id="#+id/block"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="#drawable/block" />
<ImageView
android:id="#+id/thumbdown"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:src="#drawable/thumbdown" />
<ImageView
android:id="#+id/thumbup"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="#drawable/thumbup" />
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="bottom" >
<TextView
android:id="#+id/sharetext"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_horizontal"
android:text="شارك"
android:textSize="12dp" />
<TextView
android:id="#+id/blocktext"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_horizontal"
android:text="إبلاغ إساءة"
android:textSize="12dp" />
<TextView
android:id="#+id/dislikenumber"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_horizontal"
android:textColor="#FF0000"
android:textSize="12dp" />
<TextView
android:id="#+id/likenumber"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_horizontal"
android:textColor="#00FF00"
android:textSize="12dp" />
</TableRow>
</TableLayout>
</LinearLayout>
</RelativeLayout>
but it doesn't seems to be working as I want it to be. I need it like the following figure:
The problem with my code is the list view I can't stretch it to the bottom before the tablelayout. The other problem comes if the textview at the top is too long, it appears under the tablelayout and it's visible.
Also the tablelayout at the bottom shifted up when the keyboard is visible, I don't want this to happen.
Any suggestion please?
Have a single ListView in your layout. You can add other views(as shown in your diagram) as headers to the list view using addHeaderView() method. This way you will get the Scrolling effect as you desired.
Thank you all for your support. I came up with a better solution:
<?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="#FFFFFF"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical" >
<ScrollView
android:layout_width="fill_parent"
android:layout_height="70dp"
android:layout_weight="1" >
<TextView
android:id="#+id/nektaText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="example text will not be used"
android:textAlignment="center"
android:textSize="10pt" />
</ScrollView>
<ImageView
android:id="#+id/horilinee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:src="#drawable/horiline" />
<TableRow
android:id="#+id/table"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0.5"
android:gravity="bottom" >
<Button
android:id="#+id/send"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="4"
android:text="أرسل" />
<EditText
android:id="#+id/commenttext"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="اكتب التعليق هنا"
android:minLines="1"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:scrollHorizontally="true"
android:scrollbars="vertical"
android:singleLine="false" />
</TableRow>
<ImageView
android:id="#+id/horilineee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="5dp"
android:paddingTop="5dp"
android:src="#drawable/horiline" />
<ListView
android:id="#id/android:list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="50"
android:drawSelectorOnTop="false"
android:paddingLeft="5dp"
android:paddingRight="5dp" />
</LinearLayout>
<LinearLayout
android:id="#+id/layout0"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="end" >
<TableLayout
android:id="#+id/tableLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TableRow
android:id="#+id/tableRow0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="bottom"
android:paddingBottom="10dp"
android:paddingTop="10dp" >
<ImageView
android:id="#+id/horiline"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="#drawable/horiline" />
</TableRow>
<TableRow
android:id="#+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="bottom" >
<ImageView
android:id="#+id/share"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:src="#drawable/share" />
<ImageView
android:id="#+id/block"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="#drawable/block" />
<ImageView
android:id="#+id/thumbdown"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:src="#drawable/thumbdown" />
<ImageView
android:id="#+id/thumbup"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="#drawable/thumbup" />
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:gravity="bottom" >
<TextView
android:id="#+id/sharetext"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_horizontal"
android:text="شارك"
android:textSize="12dp" />
<TextView
android:id="#+id/blocktext"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_horizontal"
android:text="إبلاغ إساءة"
android:textSize="12dp" />
<TextView
android:id="#+id/dislikenumber"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_horizontal"
android:textColor="#FF0000"
android:textSize="12dp" />
<TextView
android:id="#+id/likenumber"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_horizontal"
android:textColor="#00FF00"
android:textSize="12dp" />
</TableRow>
</TableLayout>
</LinearLayout>
</LinearLayout>
ScrollView needs to declare :
android:layout_above="#+id/Layout1"
Layout1 is the layout that host tableLayout1
But you will have some issues with ListView into scrollView
As there are only two Layout in your RelativeLayout, use LinearLayout. This will solve the overlap problem. Set the weight of ScrollView to keep the TableLayout at bottom.
The keyboard shift the Bottom table layout because it's mode is set to Resize. You will usually control this behavior through the android:windowSoftInputMode attribute on each definition in your AndroidManifest.xml. Set the value of this to adjustPan.