是否可以在Android Studio中组合图像和字符串

这是代码示例。我要结合图像和字符串数组。

Question t1 = new Question (question: "image",option1: "A",option2: "B")

kangzhai77 回答:是否可以在Android Studio中组合图像和字符串

您可以尝试

var data = mutableListOf<Any>()

data.add("your image")
data.add("your string")
data.add("or any your type data")
,

最简单的方法是在垂直LinearLayout内结合ImageView和RadioButton的自定义视图。

<LinearLayout
        android:layout_width="match_parent"
        android:orientation="vertical"
        android:layout_height="match_parent">

        <ImageView
            android:src="imageSrc"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

        <RadioGroup
            android:layout_width="wrap_content"
            android:layout_height="wrap_content">

            <RadioButton
                android:text="A"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />

            <RadioButton
                android:text="B"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />
        </RadioGroup>
    </LinearLayout>
本文链接:https://www.f2er.com/3162878.html

大家都在问