【问题标题】:Android RadioButton Group With ListView [closed]带有 ListView 的 Android RadioButton 组 [关闭]
【发布时间】:2021-03-24 05:31:03
【问题描述】:

VidMate Preview

在这里,vidmate 在列表视图中使用广播组。 我怎么能像这种布局一样构建。这里音频和视频都在同一个广播组中。 怎么办?

【问题讨论】:

    标签: android listview radio-button radio-group


    【解决方案1】:

    这里有一个简单的例子来说明如何设置RadioButtons 和TextViews:

    <LinearLayout
            android:background="#EEEEEE"
            android:orientation="vertical"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/main_layut"
            android:gravity="center">
    
            <LinearLayout
                android:orientation="horizontal"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="center">
    
                <RadioButton
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="360p"
                    android:id="@+id/radioButton"
                    android:layout_gravity="center"
                    android:layout_margin="10dp"
                    android:checked="false"/>
    
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="mp4"
                    android:layout_margin="10dp"/>
    
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="20 MB"
                    android:layout_margin="10dp"/>
    
            </LinearLayout>
    
            <LinearLayout
                android:orientation="horizontal"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/main_layut"
                android:gravity="center">
    
                <RadioButton
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="360p"
                    android:id="@+id/radioButto"
                    android:layout_gravity="center"
                    android:layout_margin="10dp"
                    android:checked="false"/>
    
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="mp4"
                    android:layout_margin="10dp"/>
    
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="20 MB"
                    android:layout_margin="10dp"/>
    
            </LinearLayout>
    
            <LinearLayout
                android:orientation="horizontal"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/main_layut"
                android:gravity="center">
    
                <RadioButton
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="360p"
                    android:id="@+id/radioButton"
                    android:layout_gravity="center"
                    android:layout_margin="10dp"
                    android:checked="false"/>
    
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="mp4"
                    android:layout_margin="10dp"/>
    
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="20 MB"
                    android:layout_margin="10dp"/>
    
            </LinearLayout>
    
        </LinearLayout>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-11
      • 2014-05-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-18
      相关资源
      最近更新 更多