我会尽量简短。 在某些设备上启动应用程序时,CardView的排列存在问题。 我认为这是在较旧的设备上发生的。我在图片下面添加了图片,前两个问题不存在,其他两个是。
我尝试了所有操作,在Android Studio中使用所有API都能正确显示(20-29) Java代码未更改。
const
TRUE = a => b => a,
FALSE = a => b => b,
IF = p => a => b => p(a)(b);
console.log(IF(TRUE)('1')('2')); // 1
console.log(IF(FALSE)('1')('2')); // 2
答案 0 :(得分:0)
嗨,请尝试以下代码。我已经更新了。请尝试
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
tools:context=".Capitoli">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginTop="32dp"
android:layout_marginRight="20dp">
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="hi"
android:textColor="#FFF"
android:textSize="24sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/text"
android:layout_marginTop="6dp"
android:text="58 "
android:textColor="#FFF"
android:textSize="14sp" />
<ImageView
android:layout_width="62dp"
android:layout_height="62dp"
android:layout_alignParentRight="true"
android:src="@drawable/ic_launcher" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:orientation="horizontal"
android:weightSum="2"
android:layout_height="wrap_content">
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="12dp"
android:layout_weight="1"
app:cardCornerRadius="12dp"
app:cardElevation="6dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:padding="16dp">
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:src="@drawable/whale" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="capitolo 1"
android:textColor="@color/viola"
android:textSize="18sp" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="12dp"
android:layout_weight="1"
app:cardCornerRadius="12dp"
app:cardElevation="6dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:padding="16dp">
<ImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:src="@drawable/whale" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="capitolo 1"
android:textColor="@color/viola"
android:textSize="18sp" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
</LinearLayout>
</ScrollView>