我在一个名为MyStruct的结构中有这个bool运算符,但我不知道如何将它转换为Java。在我的Java类中,我有三个变量,但这里并不重要。有小费吗?感谢。
I tried this code to get the cardviews
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/tools"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:layout_width="match_parent"
app:cardBackgroundColor="#999"
android:layout_height="270dp"
android:layout_margin="5dp"
app:cardCornerRadius="25dp"
android:elevation="5dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/tv_title"
android:text="Dance"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="38dp"
android:maxLines="1"
android:layout_marginRight="10dp"
android:layout_marginLeft="20dp"
android:textColor="#FFF"
/>
<TextView
android:id="@+id/tv_subtitle"
android:text="10:30 60min"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_title"
android:textSize="26dp"
android:maxLines="1"
android:layout_marginTop="8dp"
android:textColor="#FFF"
android:layout_marginLeft="20dp"
/>
<TextView
android:id="@+id/tv_description"
android:text="There are many forms of dance from
ball room tobarn dancing and disco to
moris dancing"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_subtitle"
android:layout_marginLeft="20dp"
android:textSize="12dp"
android:textStyle="bold"
android:maxLines="4"
android:layout_marginTop="8dp"
android:textColor="#FFF"
/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/tv_description"
android:layout_marginTop="20dp"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="@+id/left">
<TextView
android:id="@+id/tv_trainer_title"
android:text="Associated trainer"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:textSize="14dp"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:textStyle="bold"
android:textColor="#FFF"
android:layout_marginBottom="10dp"
android:layout_marginLeft="20dp"
/>
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:id="@+id/imageView2"
android:layout_marginLeft="20dp"
android:layout_below="@+id/tv_trainer_title"
android:layout_gravity="left"
android:background="@drawable/image_circle"
/>
<TextView
android:id="@+id/textView4"
android:text="TextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12dp"
android:textStyle="bold"
android:layout_gravity="left"
android:layout_marginLeft="20dp"
/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:id="@+id/right">
<TextView
android:id="@+id/tv_trainer_price"
android:text="£5 only"
android:textSize="28dp"
android:textAlignment="center"
android:gravity="center"
android:layout_width="116dp"
android:layout_height="wrap_content"
android:layout_below="@+id/textView3"
android:layout_marginTop="0dp"
android:layout_marginRight="12dp"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="5dp"
/>
<Button
android:id="@+id/btn_book_now"
android:background="@drawable/image_roundedcorner"
android:layout_marginRight="30dp"
android:layout_width="170dp"
android:layout_height="wrap_content"
android:text="Book now"
android:textStyle="normal"
android:textSize="18dp"/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
更新:我不知道该怎么做。