Android:Row.xml 的相对布局

标签 android android-layout layout android-relativelayout

我多次尝试绘制如下图所示的相对布局。但没有成功。 enter image description here

我用颜料设计图像是为了更好地解释我的意思。 有什么建议吗?

最佳答案

试试这个(这是我在评论中首先提出的布局):

<LinearLayout
    xmlns
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    >
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:orientation="horizontal"
        >
        <TextView
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="20"
        />
        <TextView
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="40"
        />
        <TextView
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="20"
        />
        <TextView
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="20"
        />
    </LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:orientation="horizontal"
        >
        <TextView
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
        />
        <TextView
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"
        />
    </LinearLayout>
</LinearLayout>

为了使其更可用(即:动态分配内容),请为这些 TextView 提供一些 id (android:id="@+id/txtSomething")。

显然,您可以使用任何其他控件来代替 TextView:按钮、ImageView 的任意组合。

关于Android:Row.xml 的相对布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22127368/

相关文章:

Android:在自定义按钮中使用默认突出显示颜色

android - 如何在我的 Android 应用程序中实现这样的布局?

java - 新的按钮窗口和 UI 对齐

html - 使 #div (%) 填充包装器 div 的其余部分

android - Kotlin 三元运算符

android - 使用 onBind 方法接收命令

android - PhoneGap/ Cordova : Shake Event detection not smooth

android - 监听 Android 中的布局变化

android - 将 EditText 与 TextView 关联以用于标记目的

android - 布局名称错误?