首页 前端知识 WebView加载不出Html5网页的解决方法,android studio 拾色器,ViewPager高度问题

WebView加载不出Html5网页的解决方法,android studio 拾色器,ViewPager高度问题

2024-05-10 08:05:41 前端知识 前端哥 285 5 我要收藏

`package com.base.emergency_bureau.view;

import android.content.Context; import android.util.AttributeSet; import android.view.View;

import androidx.viewpager.widget.ViewPager;

/**

  • @ProjectName: an-kefu
  • @Package: com.base.emergency_bureau.view
  • @ClassName: WrapContentHeightViewPager
  • @Description: java类作用描述
  • @Author: liys
  • @CreateDate: 2021/5/31 17:26
  • @UpdateUser: 更新者
  • @UpdateDate: 2021/5/31 17:26
  • @UpdateRemark: 更新说明
  • @Version: 1.0

*/

public class WrapContentHeightViewPager extends ViewPager {

/**

  • Constructor
  • @param context the context
    */
    public WrapContentHeightViewPager(Context context) {
    super(context);
    }

/**

  • Constructor
  • @param context the context
  • @param attrs the attribute set
    */
    public WrapContentHeightViewPager(Context context, AttributeSet attrs) {
    super(context, attrs);
    }

// @Override

// protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { // super.onMeasure(widthMeasureSpec, heightMeasureSpec); // // // find the first child view // View view = getChildAt(0); // if (view != null) { // // measure the first child view with the specified measure spec // view.measure(widthMeasureSpec, heightMeasureSpec); // } // // setMeasuredDimension(getMeasuredWidth(), measureHeight(heightMeasureSpec, view)); // } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {

int height = 0;
for(int i = 0; i < getChildCount(); i++) {
View child = getChildAt(i);
child.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
int h = child.getMeasuredHeight();
if(h > height) height = h;
}

heightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY);

super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
/**

  • Determines the height of this view
  • @param measureSpec A measureSpec packed into an int
  • @param view the base view with already measured height
  • @return The height of the view, honoring constraints from measureSpec
    */
    private int measureHeight(int measureSpec, View view) {
    int result = 0;
    int specMode = MeasureSpec.getMode(measureSpec);
    int specSize = MeasureSpec.getSize(measureSpec);
    if (specMode == MeasureSpec.EXACTLY) {

最后

都说三年是程序员的一个坎,能否晋升或者提高自己的核心竞争力,这几年就十分关键。

技术发展的这么快,从哪些方面开始学习,才能达到高级工程师水平,最后进阶到Android架构师/技术专家?我总结了这 5大块;

我搜集整理过这几年阿里,以及腾讯,字节跳动,华为,小米等公司的面试题,把面试的要求和技术点梳理成一份大而全的“ Android架构师”面试 Xmind(实际上比预期多花了不少精力),包含知识脉络 + 分支细节。

网上学习 Android的资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。希望这份系统化的技术体系对大家有一个方向参考。

2021年虽然路途坎坷,都在说Android要没落,但是,不要慌,做自己的计划,学自己的习,竞争无处不在,每个行业都是如此。相信自己,没有做不到的,只有想不到的。祝大家2021年万事大吉。

加入社区》https://bbs.csdn.net/forums/4304bb5a486d4c3ab8389e65ecb71ac0
做不到的,只有想不到的。祝大家2021年万事大吉。

加入社区》https://bbs.csdn.net/forums/4304bb5a486d4c3ab8389e65ecb71ac0

转载请注明出处或者链接地址:https://www.qianduange.cn//article/7943.html
评论
发布的文章

数据持久化(Json)

2024-09-28 23:09:01

JSON Gate 开源项目教程

2024-09-28 23:09:00

【C 】Ubuntu安装jsoncpp

2024-09-28 23:09:58

http请求json

2024-09-28 23:09:58

JSON 格式详解

2024-09-28 23:09:53

大家推荐的文章
会员中心 联系我 留言建议 回顶部
复制成功!