广场使用动态获取状态栏高度给 webview
This commit is contained in:
parent
f39f2b483e
commit
7cb89035d8
@ -8,6 +8,8 @@ import android.content.ClipData;
|
|||||||
import android.content.ClipboardManager;
|
import android.content.ClipboardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.pm.PackageManager;
|
||||||
|
import android.content.pm.ResolveInfo;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -65,14 +67,18 @@ import com.yunbao.main.activity.MainActivity;
|
|||||||
import com.yunbao.main.activity.MyWalletActivity;
|
import com.yunbao.main.activity.MyWalletActivity;
|
||||||
import com.yunbao.main.dialog.EncourageDialog;
|
import com.yunbao.main.dialog.EncourageDialog;
|
||||||
import com.yunbao.main.utils.BottomBarUtil;
|
import com.yunbao.main.utils.BottomBarUtil;
|
||||||
|
import com.yunbao.main.utils.UIUtils;
|
||||||
import com.yunbao.share.ui.SharePopDialog;
|
import com.yunbao.share.ui.SharePopDialog;
|
||||||
import com.yunbao.video.activity.VideoPlayActivity;
|
import com.yunbao.video.activity.VideoPlayActivity;
|
||||||
import com.yunbao.video.utils.VideoStorge;
|
import com.yunbao.video.utils.VideoStorge;
|
||||||
|
|
||||||
|
import net.lucode.hackware.magicindicator.buildins.UIUtil;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
import org.greenrobot.eventbus.ThreadMode;
|
import org.greenrobot.eventbus.ThreadMode;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
public class MainHomeCommunityFragment extends BaseFragment {
|
public class MainHomeCommunityFragment extends BaseFragment {
|
||||||
@ -180,6 +186,18 @@ public class MainHomeCommunityFragment extends BaseFragment {
|
|||||||
view.loadUrl(jsUrl);
|
view.loadUrl(jsUrl);
|
||||||
view.reload();
|
view.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
view.postDelayed(new Runnable(){
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
int height = view.getMeasuredHeight();
|
||||||
|
|
||||||
|
int starHeight = UIUtils.getStatusBarHeight(mContext);
|
||||||
|
Log.e("网页高度", height + "");
|
||||||
|
view.loadUrl("javascript:setTop(" + 200 + ")");
|
||||||
|
}
|
||||||
|
},3000);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
mWebView.setWebChromeClient(new WebChromeClient() {
|
mWebView.setWebChromeClient(new WebChromeClient() {
|
||||||
|
14
main/src/main/java/com/yunbao/main/utils/UIUtils.java
Normal file
14
main/src/main/java/com/yunbao/main/utils/UIUtils.java
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package com.yunbao.main.utils;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
public class UIUtils {
|
||||||
|
public static int getStatusBarHeight(Context mContext) {
|
||||||
|
int result = 0;
|
||||||
|
int resourceId = mContext.getResources().getIdentifier("status_bar_height", "dimen", "android");
|
||||||
|
if (resourceId > 0) {
|
||||||
|
result = mContext.getResources().getDimensionPixelSize(resourceId);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
@ -4,7 +4,6 @@
|
|||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_marginTop="40dp"
|
|
||||||
android:id="@+id/rootView"
|
android:id="@+id/rootView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
Loading…
Reference in New Issue
Block a user