在对话框边界外查看 [英] View outside a Dialogs bounds

查看:24
本文介绍了在对话框边界外查看的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要这样的东西:

用户个人资料图片在对话框边界上弹出".

The users profile picture is "popping out" over the dialogs bounds.

我已经尝试了一切:在阳光下用每个可能的组合进行剪辑,在对话框之后动态创建视图并将其添加到根内容视图,使用单独的视图并使用 Dialog.setCustomTitle() 加载它, 修改 Images onDraw() 方法并应用各种边界/位置修改 --- 但不管怎样,图像总是被剪裁并分成两半.

I've tried everything: messing with clipping with every possibly combination under the sun, dynamically creating the view after the dialog and adding it to the root content view, using a seperate view and loading that in with Dialog.setCustomTitle(), hacking the Images onDraw() methods and applying all-sorts of bounds/positional hacks --- but no matter what the image always gets clipped and split in half.

我什至去反编译 Play 商店 APK 并看看他们是如何做到的.不幸的是,资源文件没有透露太多,我在 Smali 中找不到任何东西.

I've even gone to the extent of decompiling the Play Store APK and seeing how they did it. Unfortunately the resource files don't give much away and I can't find anything in the Smali.

有人可以帮忙吗?请... :-(

Can anyone help? Please... :-(

编辑:我只是专门讨论对话框顶部的用户个人资料图片,而不是对话框本身.

EDIT: I'm just specifically talking about the user profile image at the top of the dialog, not the dialog itself.

推荐答案

对话方式:

Dialog dialog = new Dialog(this);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.mhp);
    dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    dialog.show();  

mhp.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/transparent" >

<LinearLayout
    android:id="@+id/linearLayout1"
    android:layout_width="match_parent"
    android:layout_height="100dp"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="57dp"
    android:background="#f00"
    android:orientation="vertical" >
</LinearLayout>

<ImageView
    android:id="@+id/imageView1"
    android:layout_width="100dp"
    android:layout_height="100dp"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:src="@drawable/ic_launcher" />

</RelativeLayout>  

结果

这篇关于在对话框边界外查看的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆