如何在android中创建动态列表

如何在android中创建动态列表,android,Android,请不要给消极的标记,因为我是新的android。 到目前为止,我知道我们使用适配器来设置列表中的项目。 在onclicklisteners上,我们可以编写我们想要表现的代码。 但我有一个弹出窗口,有4个xml按钮。 我想要一个适配器,这样,如果我有3种语言,那么只有3个按钮将是可见的,如果我有7种语言,那么它应该滚动右箭头单击。 xml文件如下所示: 波普朗: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xml

请不要给消极的标记,因为我是新的android。 到目前为止,我知道我们使用适配器来设置列表中的项目。 在onclicklisteners上,我们可以编写我们想要表现的代码。 但我有一个弹出窗口,有4个xml按钮。

我想要一个适配器,这样,如果我有3种语言,那么只有3个按钮将是可见的,如果我有7种语言,那么它应该滚动右箭头单击。 xml文件如下所示: 波普朗:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/popup_w"
android:layout_height="@dimen/popup_h"
android:layout_gravity="center"
android:background="@color/popupbg" >

<TextView
    style="@style/popuptitletxt"
    android:text="Change Language" />

<ImageButton
    android:id="@+id/infobtn"
    style="@style/headerbtn"
    android:layout_alignParentRight="true"
    android:src="@drawable/close_ic" />

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="153dp"
    android:orientation="horizontal" >

    <ImageButton
        style="@style/seekbarbtn"
        android:layout_gravity="center_vertical"
        android:src="@drawable/ic_prev" />

   <HorizontalScrollView
        android:layout_width="@dimen/poplangbtn_contw"
        android:layout_height="wrap_content" >

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >

            <include layout="@layout/popup_langbtn_aod" />

            <include layout="@layout/popup_langbtn_aod" />
        </LinearLayout>
   </HorizontalScrollView>

    <ImageButton
        style="@style/seekbarbtn"
        android:layout_gravity="center_vertical"
        android:rotation="180"
        android:src="@drawable/ic_prev" />
</LinearLayout>

和popuplangbtn.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >

<Button
    android:id="@+id/langbtn1"
    style="@style/poplangbtn"
    android:text="language1" />

<Button
    android:id="@+id/langbtn2"
    style="@style/poplangbtn"
    android:text="language2" />

请帮帮我,我对这完全不熟悉