-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Comments
目前还不行,等我有空研究下这个 |
好的 Jaeger notifications@github.com于2016年4月14日周四 23:17写道:
|
我添加了一个方法,可以解决根布局的 首个子控件为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);
}
} |
@SeanZom 等我测试下是否可以 可以的话我更新下 |
@SeanZom 那个值应该是负的= =你写错啦 |
哪个?没有吧,我跑过4.4和5.0的 |
|
没有写错 |
@SeanZom 这个值正的话 是往下移啊 你跑了什么版本的? |
原来是使用场景的问题,不是谁对谁错的问题。我一阵传个我的使用例子,现在不在电脑旁。 |
好的 |
<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> |
哦哦 这样的 ,marginView 不是必须的咯 刚才弄错了 不好意思 |
你有没有QQ或者其他联系方式方便点沟通。如果要继续探究的话。marginView确实不是必须,但是ImageView依然是可以延伸到状态栏啊,5.0和4.4.4的我都试过 |
@hunao0221 最新的1.2.0 版本已经支持这个了,可以看看,issuse 我关闭了哈 |
No description provided.
The text was updated successfully, but these errors were encountered: