Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid view .setTranslationY() view cropped
    text
    copied!<p>i'm searching for hours, but don't find a solution. I have a Layout as the following:</p> <pre><code> &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/remote_parent" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" tools:context=".TevidiHome$RemoteFragment" &gt; &lt;RelativeLayout android:id="@+id/remote_extra" android:layout_width="match_parent" android:layout_height="wrap_content" tools:context=".TevidiHome$FragmentRemote" &gt; &lt;TextView android:id="@+id/remote_text_active" android:layout_width="30dp" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_marginBottom="30dp" android:background="@drawable/border" android:textColor="@android:color/holo_orange_dark" android:textSize="30sp" android:textStyle="bold" /&gt; &lt;TextView android:id="@+id/remote_text_waiting" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="35dp" android:layout_marginRight="5dp" android:layout_toLeftOf="@id/remote_text_active" android:textSize="20sp" /&gt; &lt;EditText android:id="@+id/remote_text_store" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_marginTop="-500dp" android:layout_toLeftOf="@id/remote_text_waiting" android:descendantFocusability="beforeDescendants" android:focusable="true" android:imeOptions="actionNone" android:inputType="text|textNoSuggestions" /&gt; &lt;ImageView android:id="@+id/remote_logo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/remote_text_active" android:layout_centerHorizontal="true" android:contentDescription="@string/remote_logo_desc" android:src="@drawable/number_block" /&gt; &lt;ImageView android:id="@+id/remote_border" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/remote_logo" android:layout_centerHorizontal="true" android:layout_marginTop="2dp" android:contentDescription="@string/remote_border_desc" android:src="@drawable/remote_border" /&gt; &lt;/RelativeLayout&gt; &lt;RelativeLayout android:id="@+id/remote_main" android:layout_width="match_parent" android:layout_height="fill_parent" android:layout_marginTop="3dp" android:layout_below="@id/remote_extra" &gt; &lt;ImageView android:id="@+id/tevidi_logo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:contentDescription="@string/remote_tevidi_logo_desc" android:src="@drawable/tevidi_logo" /&gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:layout_marginRight="10dp" &gt; &lt;ImageButton android:id="@+id/remote_sos" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="20dp" android:layout_marginRight="10dp" android:background="@drawable/button_sel" android:contentDescription="@string/remote_sos_desc" android:src="@drawable/sos_off" /&gt; &lt;ImageButton android:id="@+id/remote_alarm" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/button_sel" android:contentDescription="@string/remote_alarm_desc" android:src="@drawable/alarm_off" /&gt; &lt;/LinearLayout&gt; &lt;!-- Arrows --&gt; &lt;ImageButton android:id="@+id/remote_top" android:layout_width="wrap_content" android:layout_height="wrap_content" android:lenter code hereayout_above="@+id/remote_ok" android:layout_centerHorizontal="true" android:background="@drawable/button_sel" android:contentDescription="@string/remote_top_desc" android:src="@drawable/remote_top" /&gt; &lt;ImageButton android:id="@+id/remote_left" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_toLeftOf="@+id/remote_ok" android:background="@drawable/button_sel" android:contentDescription="@string/remote_left_desc" android:src="@drawable/remote_left" /&gt; &lt;ImageButton android:id="@+id/remote_ok" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:background="@drawable/button_sel" android:contentDescription="@string/remote_ok_desc" android:src="@drawable/remote_ok" /&gt; &lt;ImageButton android:id="@+id/remote_right" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_toRightOf="@+id/remote_ok" android:background="@drawable/button_sel" android:contentDescription="@string/remote_right_desc" android:src="@drawable/remote_right" /&gt; &lt;ImageButton android:id="@+id/remote_down" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/remote_ok" android:layout_centerHorizontal="true" android:background="@drawable/button_sel" android:contentDescription="@string/remote_down_desc" android:src="@drawable/remote_down" /&gt; &lt;!-- Bottom Buttons --&gt; &lt;ImageButton android:id="@+id/remote_back" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_marginLeft="10dp" android:layout_marginTop="30dp" android:background="@drawable/button_sel" android:contentDescription="@string/remote_back_desc" android:adjustViewBounds="true" android:src="@drawable/remote_back" /&gt; &lt;ImageButton android:id="@+id/remote_menu" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:layout_marginRight="10dp" android:layout_marginTop="30dp" android:background="@drawable/button_sel" android:contentDescription="@string/remote_menu_desc" android:src="@drawable/remote_menu" /&gt; &lt;/RelativeLayout&gt; &lt;/RelativeLayout&gt; </code></pre> <p>The remote_extra Layout is drawn out of the screen by View.setTranslationY(-170) and by a fling gesture it can be swipped down. That works great. The problem is: Because of the TranslationY the remote_main Layout is not at the bottom of the screen but 170pixels above. I don't manage to bring it back to the bottom. When i programmatically make the remote_main layout higher, the buttons are cut off.</p> <p>can't add screenshots. Therefore one is here: <a href="https://www.dropbox.com/s/52erx4jatzsqz80/Screenshot_2013-11-22-13-46-17.png" rel="nofollow">https://www.dropbox.com/s/52erx4jatzsqz80/Screenshot_2013-11-22-13-46-17.png</a></p> <p>And it should be like here. The empty space at the bottom should be filled with the views above: <a href="https://www.dropbox.com/s/xw8km88lmz9be4q/Screenshot_good.png" rel="nofollow">https://www.dropbox.com/s/xw8km88lmz9be4q/Screenshot_good.png</a></p> <p>I tried the following nothing helps:</p> <pre><code>LayoutParams params = rootView.findViewById(R.id.remote_parent).getLayoutParams(); rootView.findViewById(R.id.remote_parent).setTranslationY(UP_PADDING); LayoutParams params2 = rootView.findViewById(R.id.remote_main).getLayoutParams(); params2.height = 1400; ((ViewGroup) rootView.findViewById(R.id.remote_parent)).setClipChildren(false); ((ViewGroup) rootView.findViewById(R.id.remote_main)).setClipChildren(false); rootView.requestLayout(); rootView.invalidate(); </code></pre> <p>Does anybody have a solution?</p>
 

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