弹出sub View在当前窗口
其实呢就是想做一个和输入法弹出差不多的效果
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
<RelativeLayout
android:id="@+id/mediaPopup"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:visibility="gone"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="I am a media player!"
/>
</RelativeLayout>
</RelativeLayout>
function void showMediaPlayer() {
if(mMediaPopUp.getVisibility() == View.GONE) {
// Show Media Player
TranslateAnimation mAnimUp =
new TranslateAnimation(
Animation.RELATIVE_TO_SELF,
0,
Animation.RELATIVE_TO_SELF,
0,
Animation.RELATIVE_TO_SELF,
-(mMediaPopUp.getHeight()),
Animation.RELATIVE_TO_SELF,
0);
mAnimUp.setStartOffset(500);
mAnimUp.setDuration(500);
mMediaPopUp.setVisibility(View.VISIBLE);
mMediaPopUp.setAnimation(mAnimUp);
}
}
更多相关文章
- android TextView 实现自定义文字点击效果
- Android中的Button自定义点击效果
- android使用xml实现虚线效果
- Android:实现类似RadioButton自动换行及单选效果
- Android 中带有进度条效果的按钮(Button)
- Android 修改默认输入法
- android和ios button点击变暗效果
- Android给控件添加默认点击效果