Note that there are some explanatory texts on larger screens.

plurals
  1. POSliding a view Partially in a layout
    text
    copied!<p>I have a two views in a layout.On the click of a button in view 1 the second view must be visible and view 1 must be dragged in(Though not completely).I am sorry if havent been clear.To simplify things i am attaching some images.<img src="https://i.stack.imgur.com/vVpaz.png" alt="enter image description here"></p> <p>When i click on Button 2; View 1 becomes visible(View in white) and should occupy about 85 % of the screen and only a portion of the blue ball should be visible on the screen.What i have done so far is I have given weight to view 1 as 0.2 and to view 2 as 0.80.And view 1 as gone .On the button click(Button 2) i have made view 1 as visible.This works ok but i want only portion of the blue ball be visible on screen however the blue ball appears sqeezed instead of only part of the ball be visible.Can some one tell me what am i doing wrong in this?Or is there some other approach to do this?Thanks in advance If some one could help me in this!!!</p> <p>My xml file is as follows :</p> <p> </p> <pre><code>&lt;LinearLayout android:id="@+id/rootlayout" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" android:weightSum="1" &gt; &lt;LinearLayout android:id="@+id/bbb" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="0.9" &gt; &lt;include android:id="@+id/background_template_top" android:layout_width="match_parent" android:layout_height="wrap_content" layout="@layout/menuitems" /&gt; &lt;/LinearLayout&gt; &lt;RelativeLayout android:id="@+id/parentlayout" android:layout_width="0dp" android:layout_height="match_parent" android:orientation="vertical" android:layout_weight="0.1" &gt; &lt;include android:id="@+id/background_template_top" android:layout_width="match_parent" android:layout_height="wrap_content" layout="@layout/template_top" android:layout_alignParentTop="true" &gt; &lt;/include&gt; &lt;RelativeLayout android:id="@+id/parent_middle_botom" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_below="@+id/background_template_top" &gt; &lt;RelativeLayout android:id="@+id/middle" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/black_strip_med" android:layout_below="@+id/background_template_top" &gt; &lt;LinearLayout android:id="@+id/text_data" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:layout_toRightOf="@+id/imageView1" android:layout_marginLeft="30dp" android:orientation="vertical" &gt; &lt;TextView android:id="@+id/welcome" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Welcome," android:textColor="#FFFFFFFF" android:textSize="20sp" android:singleLine="true" &gt; &lt;/TextView&gt; &lt;TextView android:id="@+id/name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Joyson" android:layout_below="@+id/welcome" android:textColor="#FFFFFFFF" android:textSize="24sp" android:singleLine="true" &gt; &lt;/TextView&gt; &lt;/LinearLayout&gt; &lt;/RelativeLayout&gt; &lt;include android:id="@+id/background_template_bottom" android:layout_width="match_parent" android:layout_height="match_parent" layout="@layout/template_bottom" android:layout_below="@+id/middle" &gt; &lt;/include&gt; &lt;ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:background="@drawable/round_sm_device" android:layout_marginLeft="20dp" android:layout_marginTop="10dp" /&gt; &lt;RelativeLayout android:id="@+id/details" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/imageView1" android:layout_marginLeft="28dp" &gt; &lt;ImageView android:id="@+id/imageView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/btn_on_small" /&gt; &lt;TextView android:id="@+id/currentbatch" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Current Batch :" android:layout_toRightOf="@+id/imageView2" android:textSize="20dp" android:textStyle="bold" android:singleLine="true" /&gt; &lt;ImageView android:id="@+id/dummy" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/btn_on_small" android:layout_below="@+id/imageView2" android:visibility="invisible" /&gt; &lt;TextView android:id="@+id/count" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/currentbatch" android:text="0" android:layout_toRightOf="@+id/dummy" android:layout_marginLeft="4dp" android:layout_marginTop="4dp" &gt; &lt;/TextView&gt; &lt;TextView android:id="@+id/Transaction" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Transactions |" android:layout_toRightOf="@+id/count" android:layout_marginLeft="4dp" android:layout_below="@+id/currentbatch" android:layout_marginTop="4dp" android:textSize="15sp" android:singleLine="true" &gt; &lt;/TextView&gt; &lt;TextView android:id="@+id/value" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="$ 0.00" android:layout_toRightOf="@+id/Transaction" android:layout_marginLeft="4dp" android:layout_below="@+id/currentbatch" android:layout_marginTop="4dp" android:textSize="15sp" android:singleLine="true" &gt; &lt;/TextView&gt; &lt;/RelativeLayout&gt; &lt;RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:background="@drawable/welcome_bg_small" &gt; &lt;/RelativeLayout&gt; &lt;/RelativeLayout&gt; &lt;/RelativeLayout&gt; &lt;/LinearLayout&gt; &lt;/RelativeLayout&gt; </code></pre> <p>This is the file that i have included:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;ScrollView android:layout_height="wrap_content" android:layout_width="match_parent" android:layout_centerHorizontal="true" android:scrollbars="none" android:layout_marginTop="14dp"&gt; &lt;RelativeLayout android:id="@+id/parentlayout" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;LinearLayout android:id="@+id/creditcard_functions" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/med_black_strip" android:orientation="vertical" &gt; &lt;TextView android:id="@+id/reporting" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Reporting" android:textColor="#FFFFFFFF" android:paddingLeft="8dp" android:textSize="20dp" android:textStyle="bold" &gt; &lt;/TextView&gt; &lt;TextView android:id="@+id/functions" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Functions" android:textColor="#FFFFFFFF" android:paddingLeft="8dp" android:textSize="20dp" android:textStyle="bold" &gt; &lt;/TextView&gt; &lt;/LinearLayout&gt; &lt;RelativeLayout android:id="@+id/sale" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/creditcard_functions" android:background="@drawable/med_black_strip" &gt; &lt;ImageView android:id="@+id/sale_image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:background="@drawable/balance_inquiry_icon" android:layout_centerVertical="true" android:layout_marginLeft="10dp" &gt; &lt;/ImageView&gt; &lt;TextView android:id="@+id/saletext" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Sale" android:layout_centerInParent="true" android:textColor="#FFFFFFFF" android:textSize="25sp" android:textStyle="bold" &gt; &lt;/TextView&gt; &lt;/RelativeLayout&gt; &lt;RelativeLayout android:id="@+id/authorizeonly" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/sale" android:background="@drawable/med_black_strip" &gt; &lt;ImageView android:id="@+id/authorize_image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:background="@drawable/balance_inquiry_icon" android:layout_centerVertical="true" android:layout_marginLeft="10dp" &gt; &lt;/ImageView&gt; &lt;TextView android:id="@+id/authorize_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Sale" android:layout_centerInParent="true" android:textColor="#FFFFFFFF" android:textSize="25sp" android:textStyle="bold" &gt; &lt;/TextView&gt; &lt;/RelativeLayout&gt; &lt;RelativeLayout android:id="@+id/Ticketonly" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/authorizeonly" android:background="@drawable/med_black_strip" &gt; &lt;ImageView android:id="@+id/ticketonly_image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:background="@drawable/balance_inquiry_icon" android:layout_centerVertical="true" android:layout_marginLeft="10dp" &gt; &lt;/ImageView&gt; &lt;TextView android:id="@+id/tickettext" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Sale" android:layout_centerInParent="true" android:textColor="#FFFFFFFF" android:textSize="25sp" android:textStyle="bold" &gt; &lt;/TextView&gt; &lt;/RelativeLayout&gt; &lt;RelativeLayout android:id="@+id/giftcardfunctions" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/Ticketonly" android:background="@drawable/med_black_strip" &gt; &lt;TextView android:id="@+id/giftcardfunctionstext" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=" Functions" android:textColor="#FFFFFFFF" android:paddingLeft="8dp" android:textSize="20dp" android:textStyle="bold" android:layout_centerVertical="true" &gt; &lt;/TextView&gt; &lt;/RelativeLayout&gt; &lt;RelativeLayout android:id="@+id/Redeem" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/giftcardfunctions" android:background="@drawable/med_black_strip" &gt; &lt;ImageView android:id="@+id/redeeem_image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:background="@drawable/balance_inquiry_icon" android:layout_centerVertical="true" android:layout_marginLeft="10dp" &gt; &lt;/ImageView&gt; &lt;TextView android:id="@+id/redeemtext" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Sale" android:layout_centerInParent="true" android:textColor="#FFFFFFFF" android:textSize="25sp" android:textStyle="bold" &gt; &lt;/TextView&gt; &lt;/RelativeLayout&gt; &lt;RelativeLayout android:id="@+id/Activate" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/Redeem" android:background="@drawable/med_black_strip" &gt; &lt;ImageView android:id="@+id/activate_image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:background="@drawable/balance_inquiry_icon" android:layout_centerVertical="true" android:layout_marginLeft="10dp" &gt; &lt;/ImageView&gt; &lt;TextView android:id="@+id/activatetext" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Sale" android:layout_centerInParent="true" android:textColor="#FFFFFFFF" android:textSize="25sp" android:textStyle="bold" &gt; &lt;/TextView&gt; &lt;/RelativeLayout&gt; &lt;RelativeLayout android:id="@+id/Deactivate" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/Activate" android:background="@drawable/med_black_strip" &gt; &lt;ImageView android:id="@+id/deactivate_image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:background="@drawable/balance_inquiry_icon" android:layout_centerVertical="true" android:layout_marginLeft="10dp" &gt; &lt;/ImageView&gt; &lt;TextView android:id="@+id/deactivatetext" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Sale" android:layout_centerInParent="true" android:textColor="#FFFFFFFF" android:textSize="25sp" android:textStyle="bold" &gt; &lt;/TextView&gt; &lt;/RelativeLayout&gt; &lt;RelativeLayout android:id="@+id/Addvalue" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/Deactivate" android:background="@drawable/med_black_strip" &gt; &lt;ImageView android:id="@+id/addvalue_image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:background="@drawable/add_value" android:layout_centerVertical="true" android:layout_marginLeft="10dp" &gt; &lt;/ImageView&gt; &lt;TextView android:id="@+id/addvaluetext" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Add Value" android:layout_centerInParent="true" android:textColor="#FFFFFFFF" android:textSize="25sp" android:textStyle="bold" &gt; &lt;/TextView&gt; &lt;/RelativeLayout&gt; &lt;RelativeLayout android:id="@+id/BalanceInquiry" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/Addvalue" android:background="@drawable/med_black_strip" &gt; &lt;ImageView android:id="@+id/balanceinquiry_image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:background="@drawable/balance_inquiry_icon" android:layout_centerVertical="true" android:layout_marginLeft="10dp" &gt; &lt;/ImageView&gt; &lt;TextView android:id="@+id/balanceinquirytext" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Balance Inquiry" android:layout_centerInParent="true" android:textColor="#FFFFFFFF" android:textSize="25sp" android:textStyle="bold" &gt; &lt;/TextView&gt; &lt;/RelativeLayout&gt; &lt;RelativeLayout android:id="@+id/Transfer" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/BalanceInquiry" android:background="@drawable/med_black_strip" &gt; &lt;ImageView android:id="@+id/transfer_image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:background="@drawable/transfer_icon" android:layout_centerVertical="true" android:layout_marginLeft="10dp" &gt; &lt;/ImageView&gt; &lt;TextView android:id="@+id/transfertext" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Transfer" android:layout_centerInParent="true" android:textColor="#FFFFFFFF" android:textSize="25sp" android:textStyle="bold" &gt; &lt;/TextView&gt; &lt;/RelativeLayout&gt; &lt;/RelativeLayout&gt; &lt;/ScrollView&gt; &lt;/RelativeLayout&gt; </code></pre>
 

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