Я ищу часы, но не могу найти решение. У меня есть макет, как:Android view .setTranslationY() view обрезано
<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" >
<RelativeLayout
android:id="@+id/remote_extra"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:context=".TevidiHome$FragmentRemote" >
<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" />
<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" />
<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" />
<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" />
<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" />
</RelativeLayout>
<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"
>
<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" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_marginRight="10dp" >
<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" />
<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" />
</LinearLayout>
<!-- Arrows -->
<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" />
<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" />
<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" />
<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" />
<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" />
<!-- Bottom Buttons -->
<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" />
<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" />
</RelativeLayout>
</RelativeLayout>
Макет remote_extra вытянут на экране View.setTranslationY (-170) и с помощью Fling жеста может быть swipped вниз. Это отлично работает. Проблема заключается в следующем: из-за TranslationY макет remote_main не находится внизу экрана, а 170 пикселей выше. Мне не удается вернуть его на дно. Когда я программно сделаю макет remote_main выше, кнопки будут отключены.
не может добавлять скриншоты. Поэтому один здесь: https://www.dropbox.com/s/52erx4jatzsqz80/Screenshot_2013-11-22-13-46-17.png
И это должно быть как здесь. Пустое пространство в нижней части должна быть заполнена с видом выше: https://www.dropbox.com/s/xw8km88lmz9be4q/Screenshot_good.png
Я попытался следующие ничего не помогает:
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();
ли кто-нибудь есть решение?
пожалуйста опубликовать некоторые снимки экрана – Tejas
добавил скриншот – Manu
Это может помочь обеспечить рисунок того, что вы хотите, чтобы экран выглядеть, так понятнее. –