小编Sum*_*hik的帖子

如何在 Android XML 布局文件中放置按钮,就像在网格视图中一样

我正在尝试在网格视图中放置 12 个按钮。这是我的布局XML文件。我该如何使用RelativeLayout来实现这一目标?我是 Android 编程新手。

 <ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
     >
     <LinearLayout 
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

    <Button
        android:id="@+id/bAries"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Aries"
        android:drawableTop="@drawable/aries" />

    <Button
        android:id="@+id/bTauras"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Tauras"
        android:drawableTop="@drawable/tauras" />

    <Button
        android:id="@+id/bGemini"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Gemini"
        android:drawableTop="@drawable/gemini" />
Run Code Online (Sandbox Code Playgroud)

android android-networking android-layout

2
推荐指数
1
解决办法
6951
查看次数