Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7718501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:10:56+00:00 2026-06-01T03:10:56+00:00

I have two layouts, one is the main layout inside which I am including

  • 0

I have two layouts, one is the main layout inside which I am including my custom keypad layout. When ever I hide the included layout, the main layout gets distorted.

My main layout xml is as follows.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/root_rl"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:background="@drawable/gradient_header" >

<LinearLayout
    android:id="@+id/linHeader"
    style="@style/linHeader"
    android:layout_height="55dp"
    android:baselineAligned="false"
    android:weightSum="1" >

    <LinearLayout
        android:id="@+id/linLogo"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight=".60"
        android:gravity="center_vertical" >

        <TextView
            android:id="@+id/tvOutletName"
            style="@style/linHeader_text"
            android:text="" >
        </TextView>
    </LinearLayout>

    <LinearLayout
        android:id="@+id/linearLayout1"
        android:layout_width="0dp"
        android:layout_height="match_parent"
        android:layout_weight=".40"
        android:gravity="right|center_vertical" >

        <LinearLayout
            android:id="@+id/btnAdvList"
            style="@style/btnChart"
            android:onClick="btnAdvList" >
        </LinearLayout>

        <LinearLayout
            android:id="@+id/btnDownArrow"
            style="@style/btnDownArrow"
            android:onClick="btnCollapseExpand" >
        </LinearLayout>

        <LinearLayout
            android:id="@+id/btnRightArrow"
            style="@style/btnRightArrow"
            android:onClick="btnDone" >
        </LinearLayout>
    </LinearLayout>
</LinearLayout>

<LinearLayout
    android:id="@+id/linSearch"
    style="@style/linSearch"
    android:layout_below="@+id/linHeader" >

    <EditText
        android:id="@+id/etSearchText"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="8dp"
        android:layout_marginRight="8dp"
        android:layout_weight="1"
        android:hint="@string/LblText_Search" />
</LinearLayout>

<LinearLayout
    android:id="@+id/linInfo"
    style="@style/linInfo"
    android:layout_below="@+id/linSearch" >

    <Spinner
        android:id="@+id/spinner1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1" >
    </Spinner>

    <Spinner
        android:id="@+id/spinner2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1" >
    </Spinner>

    <Spinner
        android:id="@+id/spinner3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1" >
    </Spinner>
</LinearLayout>

<LinearLayout
    android:id="@+id/linTitle"
    style="@style/lstTitle"
    android:layout_below="@+id/linInfo" >

    <TextView
        android:id="@+id/tvItems"
        style="@style/lstTitleText"
        android:layout_width="0dp"
        android:layout_weight="2"
        android:text="@string/LblText_Items" >
    </TextView>

    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/lsttitle_seperator" >
    </ImageView>

    <TextView
        android:id="@+id/tvOrder"
        style="@style/lstTitleText"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:text="@string/AdvList_Order" >
    </TextView>

    <ImageView
        android:id="@+id/imageView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/lsttitle_seperator" >
    </ImageView>

    <TextView
        android:id="@+id/tvTotal"
        style="@style/lstTitleText_Right"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:text="@string/AdvList_Total" >
    </TextView>
</LinearLayout>

<LinearLayout
    android:id="@+id/linBody"
    style="@style/linBody"
    android:layout_width="fill_parent"
    android:layout_height="match_parent"
    android:layout_above="@+id/linKeypad"
    android:layout_below="@+id/linTitle"
    android:orientation="vertical"
    android:weightSum="1" >

    <ExpandableListView
        android:id="@+id/expandableList"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:cacheColorHint="#00000000"
        android:childDivider="#fff"
        android:focusable="true"
        android:groupIndicator="@android:color/transparent" >
    </ExpandableListView>
</LinearLayout>

<LinearLayout
    android:id="@+id/linKeypad"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_above="@+id/linFooter" >

    <include
        android:id="@+id/linearLayoutKeyPad"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        layout="@layout/custom_decimal_keypad" />
</LinearLayout>

<LinearLayout
    android:id="@+id/linFooter"
    style="@style/linFooter" >

    <TextView
        android:id="@+id/tvOrdersTaken"
        style="@style/linFooter_text"
        android:layout_weight="1" >
    </TextView>

    <TextView
        android:id="@+id/tvTotalValue"
        style="@style/linFooter_text"
        android:layout_weight="1"
        android:gravity="right" >
    </TextView>
</LinearLayout>

</RelativeLayout>

and the included keypad layout is as follows

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearLayoutKeyPad"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#efefef"
android:orientation="vertical"
>

<TableLayout
    android:id="@+id/tableLayout1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center_horizontal" >

    <TableRow
        android:id="@+id/tableRow1"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:background="#999"
        android:gravity="center_horizontal" >

        <Button
            android:id="@+id/btnKeyPad0"
            android:layout_width="40dip"
            android:onClick="btnKeyPad0"
            android:text="0" >
        </Button>

        <Button
            android:id="@+id/btnKeyPad1"
            android:layout_width="40dip"
            android:onClick="btnKeyPad1"
            android:text="1" >
        </Button>

        <Button
            android:id="@+id/btnKeyPad2"
            android:layout_width="40dip"
            android:onClick="btnKeyPad2"
            android:text="2" >
        </Button>

        <Button
            android:id="@+id/btnKeyPad3"
            android:layout_width="40dip"
            android:onClick="btnKeyPad3"
            android:text="3" >
        </Button>

        <Button
            android:id="@+id/btnKeyPad4"
            android:layout_width="40dip"
            android:onClick="btnKeyPad4"
            android:text="4" >
        </Button>

        <ImageButton
            android:id="@+id/btnKeyPadBackSpace"
            android:layout_width="40dip"
            android:onClick="btnKeyPadBackSpace"
            android:src="@drawable/backspace" >
        </ImageButton>
    </TableRow>
</TableLayout>

<TableLayout
    android:id="@+id/tableLayout2"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center_horizontal" >

    <TableRow
        android:id="@+id/tableRow2"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:background="#999"
        android:gravity="center_horizontal" >

        <Button
            android:id="@+id/btnKeyPad5"
            android:layout_width="40dip"
            android:onClick="btnKeyPad5"
            android:text="5" >
        </Button>

        <Button
            android:id="@+id/btnKeyPad6"
            android:layout_width="40dip"
            android:onClick="btnKeyPad6"
            android:text="6" >
        </Button>

        <Button
            android:id="@+id/btnKeyPad7"
            android:layout_width="40dip"
            android:onClick="btnKeyPad7"
            android:text="7" >
        </Button>

        <Button
            android:id="@+id/btnKeyPad8"
            android:layout_width="40dip"
            android:onClick="btnKeyPad8"
            android:text="8" >
        </Button>

        <Button
            android:id="@+id/btnKeyPad9"
            android:layout_width="40dip"
            android:onClick="btnKeyPad9"
            android:text="9" >
        </Button>

        <Button
            android:id="@+id/btnKeyPadDecimal"
            android:layout_width="40dip"
            android:onClick="btnKeyPadDecimal"
            android:text="." >
        </Button>


        <Button
            android:id="@+id/btnKeyPadOk"
            android:layout_width="43dip"
            android:onClick="btnKeyPadOk"
            android:text="@string/LblText_Ok" >
        </Button>
    </TableRow>
</TableLayout>

</LinearLayout>

The expandable listview row layout is :

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linOrderTakingList"
style="@style/lstRow" >

<TextView
    android:id="@+id/tvItemDesc"
    style="@style/lstRowText"
    android:layout_width="0dp"
    android:layout_weight="2" >
</TextView>

<ImageView
    android:id="@+id/imageView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/lsttitle_seperator" >
</ImageView>

<TextView
    android:id="@+id/tvOrderQty"
    style="@style/lstRowText"
    android:layout_width="0dp"
    android:layout_weight="1" >
</TextView>

<ImageView
    android:id="@+id/imageView2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/lsttitle_seperator" >
</ImageView>

<TextView
    android:id="@+id/tvOrderValue"
    style="@style/lstRowText_Right"
    android:layout_width="0dp"
    android:layout_weight="1" >
</TextView>

</LinearLayout>

The expandable listview child layout is :

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tableLayout1"
style="@style/lstRow_Expanded_1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >

<TableRow
    android:id="@+id/tableRow1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" >

    <Button
        android:id="@+id/btnUnit"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="2"
        android:text="@string/LblText_Unit" >
    </Button>

    <Button
        android:id="@+id/btnCopy"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="2"
        android:text="@string/MenuBtnText_Copy" >
    </Button>

    <TextView
        android:id="@+id/tvQty"
        style="@style/txtLable"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:gravity="right"
        android:text="@string/AdvList_Qty" >
    </TextView>

    <TextView
        android:id="@+id/tvQtyValue"
        style="@android:style/Widget.EditText"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="2" >

        <requestFocus />
    </TextView>
</TableRow>

<TableRow
    android:id="@+id/tableRow2"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" >

    <TextView
        android:id="@+id/tvAvg"
        style="@style/txtLable"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:gravity="center"
        android:text="@string/LblText_Avg" >
    </TextView>

    <TextView
        android:id="@+id/tvLag"
        style="@style/txtLable"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:gravity="center"
        android:text="@string/LblText_Lag" >
    </TextView>

    <TextView
        android:id="@+id/tvUnitPr"
        style="@style/txtLable"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:gravity="center"
        android:text="@string/LblText_Unit_Pr" >
    </TextView>

    <TextView
        android:id="@+id/tvMrp"
        style="@style/txtLable"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:gravity="center"
        android:text="@string/LblText_MRP" >
    </TextView>

    <TextView
        android:id="@+id/tvSo"
        style="@style/txtLable"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:gravity="center"
        android:text="@string/LblText_SO" >
    </TextView>
</TableRow>

<TableRow
    android:id="@+id/tableRow3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" >

    <TextView
        android:id="@+id/tvAvgValue"
        style="@android:style/Widget.EditText"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1" />

    <TextView
        android:id="@+id/tvLagValue"
        style="@android:style/Widget.EditText"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1" />

    <TextView
        android:id="@+id/tvUnitPrValue"
        style="@android:style/Widget.EditText"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1" />

    <TextView
        android:id="@+id/tvMrpValue"
        style="@android:style/Widget.EditText"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1" />

    <TextView
        android:id="@+id/tvSoValue"
        style="@android:style/Widget.EditText"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1" />
</TableRow>

</TableLayout>

The screenshot of the layout before viewing the keypad :

image 1

and the screenshot of the distorted layout after making keypad visible :

image 2

I also tried to refresh the child view, invalidate the view, programatically modify the relative layout. Please help me with some solutions. If I don’t put the list above the keypad, it doesn’t distort, but the list view gets hidden behind the keypad which is not useful. I basically need the keypad to push the list view up when it gets visible and back to normal when it is gone.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T03:10:57+00:00Added an answer on June 1, 2026 at 3:10 am

    Since the distortion happens to the expanded view, the problem is probably in its layout.

    I’d suggest you get rid of TableLayout in your child layout: it is sometimes unpredictable and the same result may be achieved without it (using nested LinearLayout‘s, for example).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Activity with two layouts, both implemented in R.layout.main. The first one
I have a table based layout, with one main two-column table, for left and
I have a JFrame with null layout and two one character JLabels on the
I have a simple page layout with two divs--one on top, and one on
I have a layout that contains two ImageViews. I want one of them to
I need to have a single <li> element which has two buttons inside of
I have two relative layouts that are currently displayed one below the other. I
I have two activities, one is main and I have another activity called Test
I have two layouts one for portrait one for landscape. For portrait I have
I have two layouts(xml files) and I want to flip from one page to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.