xiaoyan_12 2013-01-05 08:55 采纳率: 25%
浏览 3461
已采纳

不能在relative布局中顶部和底部设置一个黑色条

这是我设置的代码:

<RelativeLayout
    android:id="@+id/layout"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" >

    <ImageView
        android:id="@+id/black_strip_top"
        android:layout_width="wrap_content"
        android:layout_above="@id/left_strip"
        android:layout_height="2dp"
        android:background="@color/black" />

    <ImageView
        android:id="@+id/black_strip_below"
        android:layout_width="wrap_content"
        android:layout_below="@id/left_strip"
        android:layout_height="2dp"
        android:background="@color/black" />

    <ImageView
        android:id="@+id/left_strip"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/left_strip" />

    <ImageView
        android:id="@+id/right_strip"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_toRightOf="@id/image"
        android:src="@drawable/right_strip" />

    <ImageView
        android:id="@+id/image"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:scaleType="fitXY" />

</RelativeLayout>

我想在图像的顶部和底部设置一个2dp的黑色条,上面的代码没有实现,要修改哪些代码片段可以实现这个效果呢?

  • 写回答

2条回答

  • yongyong_21 2013-01-06 01:55
    关注

    这个方法可以:

    alertDialog.setOnCancelListener(new OnCancelListener() {
    
        public void onCancel(DialogInterface dialog) {
            // Your code                
        }
    });
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥35 平滑拟合曲线该如何生成
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站