0

我想通过programe将TexTView中的Android:Text和Android:id随机设置为Layout Bellow

<RelativeLayout
android:id="@+id/drag"
android:layout_below="@+id/color_score"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true" >
<TextView
    android:id="@+id/1"
    android:layout_width="85dp"
    android:layout_height="33dp"
    android:layout_margin="2dp"
    android:text="1"
    android:textColor="@color/white"
    android:background="@drawable/choice_drag"
    android:gravity="center"
    android:textStyle="bold"/>
<TextView
    android:id="@+id/2"
    android:layout_width="85dp"
    android:layout_height="33dp"
    android:layout_toRightOf="@+id/1"
    android:layout_margin="2dp"
    android:text="2"
    android:textColor="@color/white"
    android:background="@drawable/choice_drag"
    android:gravity="center"
    android:textStyle="bold"/>
<TextView
    android:id="@+id/3"
    android:layout_width="85dp"
    android:layout_height="33dp"
    android:layout_toRightOf="@+id/2"
    android:layout_margin="2dp"
    android:text="3"
    android:textColor="@color/white"
    android:background="@drawable/choice_drag"
    android:gravity="center"
    android:textStyle="bold"/>
<TextView
    android:id="@+id/4"
    android:layout_width="85dp"
    android:layout_height="33dp"
    android:layout_toRightOf="@+id/3"
    android:layout_margin="2dp"
    android:text="4"
    android:textColor="@color/white"
    android:background="@drawable/choice_drag"
    android:gravity="center"
    android:textStyle="bold"/>
<TextView
    android:id="@+id/5"
    android:layout_width="85dp"
    android:layout_height="33dp"
    android:layout_toRightOf="@+id/4"
    android:layout_margin="2dp"
    android:text="5"
    android:textColor="@color/white"
    android:background="@drawable/choice_drag"
    android:gravity="center"
    android:textStyle="bold"/>
</RelativeLayout>

我想在开始活动时随机改变 TextView 的位置。示例我将有 3 次启动 Activity:

1st start activity : TextView ID and Text, will range as (1,2,3,4,5)
2nd start activity : TextView ID and Text, will range as (2,4,5,1,3)
3rd start activity : TextView ID and Text, will range as (4,5,1,2,3)

有什么方法可以做到这一点?

请!

4

0 回答 0