0
点赞
收藏
分享

微信扫一扫

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

浮游图灵 2022-02-02 阅读 80

以前的版本是可以箱ps一样直接用笔可以直接进行试色,新版的as是不能的,我么可以通过快捷键进行试色;

image.png

androidx ViewPager高度无法wrap_content问题

`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));
最后,如果大伙有什么好的学习方法或建议欢迎大家在评论中积极留言哈,希望大家能够共同学习、共同努力、共同进步。

小编在这里祝小伙伴们在未来的日子里都可以 升职加薪,当上总经理,出任CEO,迎娶白富美,走上人生巅峰!!

很多人在刚接触这个行业的时候或者是在遇到瓶颈期的时候,总会遇到一些问题,比如学了一段时间感觉没有方向感,不知道该从那里入手去学习,需要一份小编整理出来的学习资料的关注我主页或者点击我的GitHub免费领取~

这里是关于我自己的Android 学习,面试文档,视频收集大整理,有兴趣的伙伴们可以看看~

%AA%EF%BC%81.md)

这里是关于我自己的Android 学习,面试文档,视频收集大整理,有兴趣的伙伴们可以看看~

如果你看到了这里,觉得文章写得不错就给个赞呗?如果你觉得那里值得改进的,请给我留言,一定会认真查询,修正不足,谢谢。

举报

相关推荐

0 条评论