如何从 android 中的元素溢出子项?
how to overflow child items from an element in android?
我有一点布局问题,我的应用程序,我需要为一些元素设置动画,例如,将 imageView 从 0 缩放到 1。问题是:我希望使用缓动函数来实现,但是在 andriod 中,并且元素永远不会导致 "overflow",那么如果使用反弹过渡,动画元素会在某些过渡帧中被剪切
我想要制作动画的元素是:layoutChatSearchIAvatarItem
我是我的 xml:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingBottom="@dimen/ulife_gutter"
android:paddingTop="@dimen/ulife_gutter"
android:weightSum="100"
android:clipChildren="true"
android:clipToPadding="true">
<EditText
android:id="@+id/inputChatPeopleSearchInput"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical|left"
android:layout_marginLeft="@dimen/ulife_gutter"
android:background="@color/white"
android:gravity="center_vertical"
android:hint="@string/hint_chat_search"
android:selectAllOnFocus="true"
android:textColor="@color/black"
android:textColorHint="@color/lightGray"
android:textSize="@dimen/ulife_paragraph_medium_size"
android:layout_weight="35" />
<FrameLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="65"
android:clipToPadding="true"
android:clipChildren="true">
<HorizontalScrollView
android:id="@+id/horizontalScrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:isScrollContainer="true"
android:scrollbars="none"
android:clipChildren="true"
android:clipToPadding="true">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:paddingLeft="@dimen/ulife_gutter"
android:paddingRight="@dimen/ulife_gutter"
android:id="@+id/layoutChatSearchIAvatarContainer"
android:clipChildren="true"
android:clipToPadding="true">
<FrameLayout
android:id="@+id/layoutChatSearchIAvatarItem"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center_vertical"
android:layout_marginRight="@dimen/ulife_half_gutter">
<br.com.animaeducacao.ulife.Core.view.PorterShapeImageView
android:id="@+id/imageActivitieOwnerAvatar"
android:layout_width="@dimen/ulife_ic_size"
android:layout_height="@dimen/ulife_ic_size"
android:layout_gravity="right|top"
android:contentDescription="@string/alt_activitie_picture"
android:longClickable="false"
android:maxHeight="@dimen/ulife_max_height"
android:src="@drawable/user_avatar_03"
app:siShape="@drawable/mask_border_radius_avatar_stroke" />
<ImageView
android:id="@+id/imageView6"
android:layout_width="@dimen/ulife_ic_tiny_size"
android:layout_height="@dimen/ulife_ic_tiny_size"
android:layout_gravity="bottom|right"
android:background="@drawable/image_radius_gray"
android:src="@drawable/icon_x"
android:tint="@color/white" />
</FrameLayout>
</LinearLayout>
</HorizontalScrollView>
<View
android:layout_width="1dp"
android:layout_height="@dimen/ulife_ic_size"
android:background="@color/whiteSmoke" />
<ImageView
android:id="@+id/imageView7"
android:layout_width="wrap_content"
android:layout_height="@dimen/ulife_ic_size"
android:layout_gravity="center_vertical|left"
android:adjustViewBounds="true"
android:src="@drawable/gradient_overlay_small_left" />
<ImageView
android:id="@+id/imageView8"
android:layout_width="wrap_content"
android:layout_height="@dimen/ulife_ic_size"
android:layout_gravity="center_vertical|right"
android:adjustViewBounds="true"
android:src="@drawable/gradient_overlay_small_right" />
</FrameLayout>
</LinearLayout>
查看父 ViewGroup
的 clipChildren
和 clipToPadding
属性
http://developer.android.com/reference/android/view/ViewGroup.html#attr_android:clipChildren
我有一点布局问题,我的应用程序,我需要为一些元素设置动画,例如,将 imageView 从 0 缩放到 1。问题是:我希望使用缓动函数来实现,但是在 andriod 中,并且元素永远不会导致 "overflow",那么如果使用反弹过渡,动画元素会在某些过渡帧中被剪切
我想要制作动画的元素是:layoutChatSearchIAvatarItem
我是我的 xml:
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingBottom="@dimen/ulife_gutter"
android:paddingTop="@dimen/ulife_gutter"
android:weightSum="100"
android:clipChildren="true"
android:clipToPadding="true">
<EditText
android:id="@+id/inputChatPeopleSearchInput"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical|left"
android:layout_marginLeft="@dimen/ulife_gutter"
android:background="@color/white"
android:gravity="center_vertical"
android:hint="@string/hint_chat_search"
android:selectAllOnFocus="true"
android:textColor="@color/black"
android:textColorHint="@color/lightGray"
android:textSize="@dimen/ulife_paragraph_medium_size"
android:layout_weight="35" />
<FrameLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="65"
android:clipToPadding="true"
android:clipChildren="true">
<HorizontalScrollView
android:id="@+id/horizontalScrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:isScrollContainer="true"
android:scrollbars="none"
android:clipChildren="true"
android:clipToPadding="true">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:paddingLeft="@dimen/ulife_gutter"
android:paddingRight="@dimen/ulife_gutter"
android:id="@+id/layoutChatSearchIAvatarContainer"
android:clipChildren="true"
android:clipToPadding="true">
<FrameLayout
android:id="@+id/layoutChatSearchIAvatarItem"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center_vertical"
android:layout_marginRight="@dimen/ulife_half_gutter">
<br.com.animaeducacao.ulife.Core.view.PorterShapeImageView
android:id="@+id/imageActivitieOwnerAvatar"
android:layout_width="@dimen/ulife_ic_size"
android:layout_height="@dimen/ulife_ic_size"
android:layout_gravity="right|top"
android:contentDescription="@string/alt_activitie_picture"
android:longClickable="false"
android:maxHeight="@dimen/ulife_max_height"
android:src="@drawable/user_avatar_03"
app:siShape="@drawable/mask_border_radius_avatar_stroke" />
<ImageView
android:id="@+id/imageView6"
android:layout_width="@dimen/ulife_ic_tiny_size"
android:layout_height="@dimen/ulife_ic_tiny_size"
android:layout_gravity="bottom|right"
android:background="@drawable/image_radius_gray"
android:src="@drawable/icon_x"
android:tint="@color/white" />
</FrameLayout>
</LinearLayout>
</HorizontalScrollView>
<View
android:layout_width="1dp"
android:layout_height="@dimen/ulife_ic_size"
android:background="@color/whiteSmoke" />
<ImageView
android:id="@+id/imageView7"
android:layout_width="wrap_content"
android:layout_height="@dimen/ulife_ic_size"
android:layout_gravity="center_vertical|left"
android:adjustViewBounds="true"
android:src="@drawable/gradient_overlay_small_left" />
<ImageView
android:id="@+id/imageView8"
android:layout_width="wrap_content"
android:layout_height="@dimen/ulife_ic_size"
android:layout_gravity="center_vertical|right"
android:adjustViewBounds="true"
android:src="@drawable/gradient_overlay_small_right" />
</FrameLayout>
</LinearLayout>
查看父 ViewGroup
clipChildren
和 clipToPadding
属性
http://developer.android.com/reference/android/view/ViewGroup.html#attr_android:clipChildren