Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

您好,请问有办法让imageview显示在状态栏下面吗 #16

Closed
hunao0221 opened this issue Apr 12, 2016 · 15 comments
Closed

您好,请问有办法让imageview显示在状态栏下面吗 #16

hunao0221 opened this issue Apr 12, 2016 · 15 comments

Comments

@hunao0221
Copy link

No description provided.

@laobie
Copy link
Owner

laobie commented Apr 14, 2016

目前还不行,等我有空研究下这个

@hunao0221
Copy link
Author

好的

Jaeger notifications@github.com于2016年4月14日周四 23:17写道:

目前还不行,等我有空研究下这个


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#16 (comment)

@SeanZom
Copy link

SeanZom commented Jun 3, 2016

我添加了一个方法,可以解决根布局的 首个子控件为Imageview 延伸到状态栏这种情况

    /**
     *  为有 ImageView 的Activity 添加半透明状态栏
     *
     * @param act        需要设置的Activity
     * @param marginView 需要设置 margin 的 View
     */
    public static void setTranslucentForImageView(Activity act, View marginView) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            act.getWindow().setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
                addTranslucentView(act, DEFAULT_STATUS_BAR_ALPHA);
            }
            ViewGroup.MarginLayoutParams vmlp = (ViewGroup.MarginLayoutParams) marginView.getLayoutParams();
            vmlp.setMargins(0, getStatusBarHeight(act), 0, 0);
        } 
    }

@laobie
Copy link
Owner

laobie commented Jun 3, 2016

@SeanZom 等我测试下是否可以 可以的话我更新下

@laobie
Copy link
Owner

laobie commented Jun 3, 2016

@SeanZom 那个值应该是负的= =你写错啦

@SeanZom
Copy link

SeanZom commented Jun 3, 2016

哪个?没有吧,我跑过4.4和5.0的

@laobie
Copy link
Owner

laobie commented Jun 3, 2016

image
@SeanZom 这个 

@SeanZom
Copy link

SeanZom commented Jun 3, 2016

没有写错

@laobie
Copy link
Owner

laobie commented Jun 3, 2016

@SeanZom 这个值正的话 是往下移啊 你跑了什么版本的?

@SeanZom
Copy link

SeanZom commented Jun 3, 2016

原来是使用场景的问题,不是谁对谁错的问题。我一阵传个我的使用例子,现在不在电脑旁。

@laobie
Copy link
Owner

laobie commented Jun 3, 2016

好的

@SeanZom
Copy link

SeanZom commented Jun 3, 2016

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ImageView
        android:id="@+id/iv_header_img"
        android:tag="这个是 头部延伸到状态栏的Image"
        .../>

    <Button
        android:id="@+id/btn_back"
        android:tag="这个是 marginView"
        .../>
</RelativeLayout>

@laobie
Copy link
Owner

laobie commented Jun 3, 2016

哦哦 这样的 ,marginView 不是必须的咯 刚才弄错了 不好意思

@SeanZom
Copy link

SeanZom commented Jun 3, 2016

你有没有QQ或者其他联系方式方便点沟通。如果要继续探究的话。marginView确实不是必须,但是ImageView依然是可以延伸到状态栏啊,5.0和4.4.4的我都试过

@laobie
Copy link
Owner

laobie commented Jul 12, 2016

@hunao0221 最新的1.2.0 版本已经支持这个了,可以看看,issuse 我关闭了哈

@laobie laobie closed this as completed Jul 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants