在对话框边界之外查看 [英] View outside a Dialogs bounds
问题描述
我想要这样的东西:
用户个人资料图片在对话框边界上弹出".
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屋!