implementation 'androidx.appcompat:appcompat:1.3.0'
如果多个module依赖版本没有统一就会出现报错androidx.fragment.app.Fragment Result Owner' supertype of 'androidx.fragment.app.FragmentManager'. Check your module classpath for missing or conflicting dependenciesandroidx.fragment.app.Fragment Result Owner' supertype of 'androidx.fragment.app.FragmentManager'. Check your module classpath for missing or conflicting dependencies不影响编译项目运行但是看到满屏爆红想必也不是诸位想看到的
全局强制指定整个项目依赖固定版本的第三方库,避免重复依赖不同版本相同库
configurations.all {
resolutionStrategy.force 'androidx.appcompat:appcompat:1.3.1'
}
Recyclerview的GridLayoutManager可以通过setSpanSizeLookup方法动态设置每一个item的占位
数,以此来达到动态设置每行列数的效果
val gridLayoutManager = GridLayoutManager(context, 2);
gridLayoutManager.spanSizeLookup=object :GridLayoutManager.SpanSizeLookup(){
override fun getSpanSize(position: Int): Int {
return if(position==0){
2//第一个item占两个item位置
}else{
1//其余item依然只占一个位置
}
}
}
<com.yigou.one.widget.RadiusCardView
android:layout_width="@dimen/dimen_594"
android:layout_height="match_parent"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/dimen_44"
android:layout_marginBottom="@dimen/dimen_33"
app:cardElevation="0dp">
CardView在RelativeLayout中使用是会一直在viewTree的顶层显示,因为cardview默
认cardElevation有值布局厚度会大于一般控件所以一直显示在顶层。用下面代码设置为0
就可正常显示其他view
app:cardElevation="0dp"
java.lang.IllegalStateException: Pages must fill the whole ViewPager2 (use match_parent)
viewpager2 item布局必须使用match_parent
Only fullscreen opaque activities can request orientation
解决办法:
android:screenOrientation="portrait"去掉清单文件中设置的方向
网友评论