Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid : View and hide included layouts in relative layout
    primarykey
    data
    text
    <p>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.</p> <p>My main layout xml is as follows.</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;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" &gt; &lt;LinearLayout android:id="@+id/linHeader" style="@style/linHeader" android:layout_height="55dp" android:baselineAligned="false" android:weightSum="1" &gt; &lt;LinearLayout android:id="@+id/linLogo" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight=".60" android:gravity="center_vertical" &gt; &lt;TextView android:id="@+id/tvOutletName" style="@style/linHeader_text" android:text="" &gt; &lt;/TextView&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:id="@+id/linearLayout1" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight=".40" android:gravity="right|center_vertical" &gt; &lt;LinearLayout android:id="@+id/btnAdvList" style="@style/btnChart" android:onClick="btnAdvList" &gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:id="@+id/btnDownArrow" style="@style/btnDownArrow" android:onClick="btnCollapseExpand" &gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:id="@+id/btnRightArrow" style="@style/btnRightArrow" android:onClick="btnDone" &gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:id="@+id/linSearch" style="@style/linSearch" android:layout_below="@+id/linHeader" &gt; &lt;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" /&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:id="@+id/linInfo" style="@style/linInfo" android:layout_below="@+id/linSearch" &gt; &lt;Spinner android:id="@+id/spinner1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" &gt; &lt;/Spinner&gt; &lt;Spinner android:id="@+id/spinner2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" &gt; &lt;/Spinner&gt; &lt;Spinner android:id="@+id/spinner3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" &gt; &lt;/Spinner&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:id="@+id/linTitle" style="@style/lstTitle" android:layout_below="@+id/linInfo" &gt; &lt;TextView android:id="@+id/tvItems" style="@style/lstTitleText" android:layout_width="0dp" android:layout_weight="2" android:text="@string/LblText_Items" &gt; &lt;/TextView&gt; &lt;ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/lsttitle_seperator" &gt; &lt;/ImageView&gt; &lt;TextView android:id="@+id/tvOrder" style="@style/lstTitleText" android:layout_width="0dp" android:layout_weight="1" android:text="@string/AdvList_Order" &gt; &lt;/TextView&gt; &lt;ImageView android:id="@+id/imageView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/lsttitle_seperator" &gt; &lt;/ImageView&gt; &lt;TextView android:id="@+id/tvTotal" style="@style/lstTitleText_Right" android:layout_width="0dp" android:layout_weight="1" android:text="@string/AdvList_Total" &gt; &lt;/TextView&gt; &lt;/LinearLayout&gt; &lt;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" &gt; &lt;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" &gt; &lt;/ExpandableListView&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:id="@+id/linKeypad" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_above="@+id/linFooter" &gt; &lt;include android:id="@+id/linearLayoutKeyPad" android:layout_width="match_parent" android:layout_height="wrap_content" layout="@layout/custom_decimal_keypad" /&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:id="@+id/linFooter" style="@style/linFooter" &gt; &lt;TextView android:id="@+id/tvOrdersTaken" style="@style/linFooter_text" android:layout_weight="1" &gt; &lt;/TextView&gt; &lt;TextView android:id="@+id/tvTotalValue" style="@style/linFooter_text" android:layout_weight="1" android:gravity="right" &gt; &lt;/TextView&gt; &lt;/LinearLayout&gt; &lt;/RelativeLayout&gt; </code></pre> <p>and the included keypad layout is as follows</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;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" &gt; &lt;TableLayout android:id="@+id/tableLayout1" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" &gt; &lt;TableRow android:id="@+id/tableRow1" android:layout_width="wrap_content" android:layout_height="fill_parent" android:background="#999" android:gravity="center_horizontal" &gt; &lt;Button android:id="@+id/btnKeyPad0" android:layout_width="40dip" android:onClick="btnKeyPad0" android:text="0" &gt; &lt;/Button&gt; &lt;Button android:id="@+id/btnKeyPad1" android:layout_width="40dip" android:onClick="btnKeyPad1" android:text="1" &gt; &lt;/Button&gt; &lt;Button android:id="@+id/btnKeyPad2" android:layout_width="40dip" android:onClick="btnKeyPad2" android:text="2" &gt; &lt;/Button&gt; &lt;Button android:id="@+id/btnKeyPad3" android:layout_width="40dip" android:onClick="btnKeyPad3" android:text="3" &gt; &lt;/Button&gt; &lt;Button android:id="@+id/btnKeyPad4" android:layout_width="40dip" android:onClick="btnKeyPad4" android:text="4" &gt; &lt;/Button&gt; &lt;ImageButton android:id="@+id/btnKeyPadBackSpace" android:layout_width="40dip" android:onClick="btnKeyPadBackSpace" android:src="@drawable/backspace" &gt; &lt;/ImageButton&gt; &lt;/TableRow&gt; &lt;/TableLayout&gt; &lt;TableLayout android:id="@+id/tableLayout2" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" &gt; &lt;TableRow android:id="@+id/tableRow2" android:layout_width="wrap_content" android:layout_height="fill_parent" android:background="#999" android:gravity="center_horizontal" &gt; &lt;Button android:id="@+id/btnKeyPad5" android:layout_width="40dip" android:onClick="btnKeyPad5" android:text="5" &gt; &lt;/Button&gt; &lt;Button android:id="@+id/btnKeyPad6" android:layout_width="40dip" android:onClick="btnKeyPad6" android:text="6" &gt; &lt;/Button&gt; &lt;Button android:id="@+id/btnKeyPad7" android:layout_width="40dip" android:onClick="btnKeyPad7" android:text="7" &gt; &lt;/Button&gt; &lt;Button android:id="@+id/btnKeyPad8" android:layout_width="40dip" android:onClick="btnKeyPad8" android:text="8" &gt; &lt;/Button&gt; &lt;Button android:id="@+id/btnKeyPad9" android:layout_width="40dip" android:onClick="btnKeyPad9" android:text="9" &gt; &lt;/Button&gt; &lt;Button android:id="@+id/btnKeyPadDecimal" android:layout_width="40dip" android:onClick="btnKeyPadDecimal" android:text="." &gt; &lt;/Button&gt; &lt;Button android:id="@+id/btnKeyPadOk" android:layout_width="43dip" android:onClick="btnKeyPadOk" android:text="@string/LblText_Ok" &gt; &lt;/Button&gt; &lt;/TableRow&gt; &lt;/TableLayout&gt; &lt;/LinearLayout&gt; </code></pre> <p>The expandable listview row layout is :</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/linOrderTakingList" style="@style/lstRow" &gt; &lt;TextView android:id="@+id/tvItemDesc" style="@style/lstRowText" android:layout_width="0dp" android:layout_weight="2" &gt; &lt;/TextView&gt; &lt;ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/lsttitle_seperator" &gt; &lt;/ImageView&gt; &lt;TextView android:id="@+id/tvOrderQty" style="@style/lstRowText" android:layout_width="0dp" android:layout_weight="1" &gt; &lt;/TextView&gt; &lt;ImageView android:id="@+id/imageView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/lsttitle_seperator" &gt; &lt;/ImageView&gt; &lt;TextView android:id="@+id/tvOrderValue" style="@style/lstRowText_Right" android:layout_width="0dp" android:layout_weight="1" &gt; &lt;/TextView&gt; &lt;/LinearLayout&gt; </code></pre> <p>The expandable listview child layout is :</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;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" &gt; &lt;TableRow android:id="@+id/tableRow1" android:layout_width="wrap_content" android:layout_height="wrap_content" &gt; &lt;Button android:id="@+id/btnUnit" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="2" android:text="@string/LblText_Unit" &gt; &lt;/Button&gt; &lt;Button android:id="@+id/btnCopy" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="2" android:text="@string/MenuBtnText_Copy" &gt; &lt;/Button&gt; &lt;TextView android:id="@+id/tvQty" style="@style/txtLable" android:layout_width="0dp" android:layout_weight="1" android:gravity="right" android:text="@string/AdvList_Qty" &gt; &lt;/TextView&gt; &lt;TextView android:id="@+id/tvQtyValue" style="@android:style/Widget.EditText" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="2" &gt; &lt;requestFocus /&gt; &lt;/TextView&gt; &lt;/TableRow&gt; &lt;TableRow android:id="@+id/tableRow2" android:layout_width="fill_parent" android:layout_height="wrap_content" &gt; &lt;TextView android:id="@+id/tvAvg" style="@style/txtLable" android:layout_width="0dp" android:layout_weight="1" android:gravity="center" android:text="@string/LblText_Avg" &gt; &lt;/TextView&gt; &lt;TextView android:id="@+id/tvLag" style="@style/txtLable" android:layout_width="0dp" android:layout_weight="1" android:gravity="center" android:text="@string/LblText_Lag" &gt; &lt;/TextView&gt; &lt;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" &gt; &lt;/TextView&gt; &lt;TextView android:id="@+id/tvMrp" style="@style/txtLable" android:layout_width="0dp" android:layout_weight="1" android:gravity="center" android:text="@string/LblText_MRP" &gt; &lt;/TextView&gt; &lt;TextView android:id="@+id/tvSo" style="@style/txtLable" android:layout_width="0dp" android:layout_weight="1" android:gravity="center" android:text="@string/LblText_SO" &gt; &lt;/TextView&gt; &lt;/TableRow&gt; &lt;TableRow android:id="@+id/tableRow3" android:layout_width="wrap_content" android:layout_height="wrap_content" &gt; &lt;TextView android:id="@+id/tvAvgValue" style="@android:style/Widget.EditText" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" /&gt; &lt;TextView android:id="@+id/tvLagValue" style="@android:style/Widget.EditText" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" /&gt; &lt;TextView android:id="@+id/tvUnitPrValue" style="@android:style/Widget.EditText" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" /&gt; &lt;TextView android:id="@+id/tvMrpValue" style="@android:style/Widget.EditText" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" /&gt; &lt;TextView android:id="@+id/tvSoValue" style="@android:style/Widget.EditText" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" /&gt; &lt;/TableRow&gt; &lt;/TableLayout&gt; </code></pre> <p>The screenshot of the layout before viewing the keypad : </p> <p><img src="https://i.stack.imgur.com/pPcpe.png" alt="image 1"></p> <p>and the screenshot of the distorted layout after making keypad visible :</p> <p><img src="https://i.stack.imgur.com/TFjdk.png" alt="image 2"></p> <p>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.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload