O_Casper_ne 2013-02-04 05:33 采纳率: 7.7%
浏览 3123
已采纳

把 button 放在框架布局 frame layout 左边的问题

在一个垂直的线性布局中设置了两个textviews,还有一个button和一个frame layout框架布局。
我要把按钮放在框架布局的左边,并把按钮放在 relative layout布局中。
但是如何把框架布局 frame layout 放在右边呢?

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/content_container_white"
    android:orientation="vertical" >
    <TextView
        android:id="@+id/editText1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingLeft="30dp"
        android:text="@string/t0"
        android:textColor="@color/black"
        android:textSize="30dp" />
    <TextView
        android:id="@+id/editText2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/t1"
        android:textColor="@color/black" />
    <RelativeLayout
        android:id="@+id/RelativeLayout1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >
        <Button
            android:id="@+id/buybtn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="left"
            android:layout_marginLeft="30dp"
            android:text="@string/buy_button" />
    </RelativeLayout>
    <FrameLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal|right"
        android:layout_marginTop="10dp" >
        <ImageButton
            android:id="@+id/videothumb"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal|center_vertical"
            android:src="@drawable/button_play_on" />
        <ImageView
            android:id="@+id/videothumbimage"
            android:layout_width="380dp"
            android:layout_height="170dp"
            android:scaleType="centerCrop"
            android:src="@drawable/demo_thumb_home" />
    </FrameLayout>
</LinearLayout>
  • 写回答

2条回答 默认 最新

  • balmy 2013-02-04 08:20
    关注

    把FrameLayout外面在添加一个线性或相对布局试试,这个布局和你之前`android:id="@+id/RelativeLayout1"布局是平级的,要不然Framelayout总是默认在左边,

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥30 Windows Server 2016利用兩張網卡處理兩個不同網絡
  • ¥15 Python中knn问题
  • ¥15 使用C#,asp.net读取Excel文件并保存到Oracle数据库
  • ¥15 C# datagridview 单元格显示进度及值
  • ¥15 thinkphp6配合social login单点登录问题
  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源