我有一个RecyclerView作为唯一的孩子SwipeRefreshLayout,我想要RecyclerView wrap_content.当我将它们都设置为"wrap_content"时,它不起作用.该RecyclerView用的项目也较少match_parent.当我删除SwipeRefreshLayout,RecyclerView意志wrap_content.谁能帮我?我的英语很差,也许你无法理解.有人可以帮帮我吗?非常感谢你.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/container_v"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.SwipeRefreshLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#00ffff">
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ff00ff">
</android.support.v7.widget.RecyclerView>
</android.support.v4.widget.SwipeRefreshLayout>
Run Code Online (Sandbox Code Playgroud)
android swiperefreshlayout android-recyclerview android-wrap-content
我想知道在 switch 语句中使用break或return时的一些区别。哪个更有效率?有人可以向我解释一下吗?非常感谢。代码如下:
public void foo(){
int i = 10;
switch (i) {
case 1: {
//code here
break; //or return;
}
case 2: {
//code here
break; //or return;
}
// code code
// code code
// code code
case 10:{
//code here
break; //or return;
}
default:{
//code here
break; //or return;
}
}
}
Run Code Online (Sandbox Code Playgroud)