Layout overlaying another layout after dynamically change

Nurkanat Khametov

I'm suffering some problems with my layouts in my app. After changing text of TextView (dynamically) to some long text, it overlays my TableLayout. Hope you can help me to determine how to move TableLayout to visible range.

UPD. My bad, that I'm not defined which TextView I've changed. It's TextView above TableLayout with id = textView.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.home.myapp1.MainActivity"
    android:orientation="vertical">

    <TextView
        android:id="@+id/textView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:scrollbars="vertical"
        android:text="Hello world!"
        android:singleLine="false"/>

    <TableLayout android:layout_marginTop="10dp"
        android:id="@+id/table"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:stretchColumns="*">
        <TableRow android:padding="5dp">
            <TextView android:text="Валюта" android:gravity="center_horizontal"/>
            <TextView android:text="Покупка" android:gravity="center_horizontal"/>
            <TextView android:text="Продажа" android:gravity="center_horizontal"/>
        </TableRow>
    </TableLayout>
</LinearLayout>
Gautam Malik

I tried using the given layout xml and changed the text of textview dynamically (for testing purpose I changed text on button click which I placed below the TableLayout) but it was working fine until and unless TextView covers the whole screen height. If there is no limit for your textview, then should use ScrollView as the parent of your layout. So try replacing your xml content with below content and it may solve your issue:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.home.myapp1.MainActivity"
    android:orientation="vertical">

    <TextView
        android:id="@+id/textView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:scrollbars="vertical"
        android:text="Hello world!"
        android:singleLine="false"/>

    <TableLayout android:layout_marginTop="10dp"
        android:id="@+id/table"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:stretchColumns="*">
        <TableRow android:padding="5dp">
            <TextView android:text="Валюта"   android:gravity="center_horizontal"/>
            <TextView android:text="Покупка" android:gravity="center_horizontal"/>
            <TextView android:text="Продажа" android:gravity="center_horizontal"/>
        </TableRow>
    </TableLayout>
</LinearLayout>

</ScrollView>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Dynamically add layout to another layout

From Dev

change Auto Layout dynamically

From Dev

Dynamically add Layout after some layout?

From Dev

How to change adapter layout dynamically?

From Dev

How to change the page layout dynamically

From Dev

Change TextView from another Layout

From Dev

Layout not refreshing after orientation change

From Dev

Dynamically include another layout in Fragment Activity

From Dev

Dynamically include another layout in Fragment Activity

From Dev

Android: Navigation Drawer Layout Dynamically change icon

From Dev

ability to change layout of html dynamically by user

From Dev

Change extends(layout) dynamically in laravel 5

From Dev

Dynamically change position of grid layout items

From Dev

Android - How to dynamically change fragment layout

From Dev

Dynamically change the image color layout in a row in a GridView

From Dev

How to change Layout background dynamically in Android?

From Dev

Dynamically change position of grid layout items

From Dev

Java GridLayout how to dynamically change grid layout

From Dev

Android: How to dynamically change the Layout of my ViewPager

From Dev

android: layout background turns black after hiding another layout

From Dev

How to reach and change elements of a layout of another activity?

From Dev

How to change layout background from another activity?

From Dev

Cannot change keyboard layout after uninstalling Unity

From Dev

how to change auto layout constraints after add

From Dev

setting onClickListener after layout change not working

From Dev

PyQt: Change GUI Layout after button is clicked

From Dev

How To Reload xserver After a Change in Keyboard Layout?

From Dev

Checkbox losing check after layout width change

From Dev

Set a layout over another layout

Related Related

  1. 1

    Dynamically add layout to another layout

  2. 2

    change Auto Layout dynamically

  3. 3

    Dynamically add Layout after some layout?

  4. 4

    How to change adapter layout dynamically?

  5. 5

    How to change the page layout dynamically

  6. 6

    Change TextView from another Layout

  7. 7

    Layout not refreshing after orientation change

  8. 8

    Dynamically include another layout in Fragment Activity

  9. 9

    Dynamically include another layout in Fragment Activity

  10. 10

    Android: Navigation Drawer Layout Dynamically change icon

  11. 11

    ability to change layout of html dynamically by user

  12. 12

    Change extends(layout) dynamically in laravel 5

  13. 13

    Dynamically change position of grid layout items

  14. 14

    Android - How to dynamically change fragment layout

  15. 15

    Dynamically change the image color layout in a row in a GridView

  16. 16

    How to change Layout background dynamically in Android?

  17. 17

    Dynamically change position of grid layout items

  18. 18

    Java GridLayout how to dynamically change grid layout

  19. 19

    Android: How to dynamically change the Layout of my ViewPager

  20. 20

    android: layout background turns black after hiding another layout

  21. 21

    How to reach and change elements of a layout of another activity?

  22. 22

    How to change layout background from another activity?

  23. 23

    Cannot change keyboard layout after uninstalling Unity

  24. 24

    how to change auto layout constraints after add

  25. 25

    setting onClickListener after layout change not working

  26. 26

    PyQt: Change GUI Layout after button is clicked

  27. 27

    How To Reload xserver After a Change in Keyboard Layout?

  28. 28

    Checkbox losing check after layout width change

  29. 29

    Set a layout over another layout

HotTag

Archive