qq_34042153 2016-07-12 07:31 采纳率: 20%
浏览 1067
已采纳

安卓的Dialog的小问题

图片说明

这样的效果怎么实现,主要是那个图片一半在里面,一般在外面???

  • 写回答

6条回答 默认 最新

  • 新根 2016-07-12 09:48
    关注

    美工给定的图片
    图片说明
    实现效果:
    图片说明

    实现方式:
    最外层透明,然后先shape白色外框,按钮等,最后放美工给定的图片实现叠加效果

    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/transparent">//最外层透明色

    <RelativeLayout //白色圆角外边框
        android:id="@+id/gasgauard_notice_contentlayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
       android:layout_below="@+id/gasgauard_notice_top"
        android:layout_marginTop="-25dp"  //确定白色部分与顶部图片叠加的大小
        android:background="@drawable/shape_gasguardset_dialog">
    
        <TextView
            android:id="@+id/gasgauard_notice_content1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_marginBottom="15dp"
            android:layout_marginTop="45dp"
            android:text="确定推送无气警报?" />
    
        <TextView
            android:id="@+id/gasguardset_content_two"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/gasgauard_notice_content1"
            android:layout_centerHorizontal="true"
            android:layout_marginBottom="15dp"
            android:text="是否将库存不足信息提示相关人员"
            android:textColor="#999999" />
    
        <LinearLayout
    
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/gasguardset_content_two"
            android:layout_marginBottom="20dp"
            android:layout_marginTop="10dp"
            android:orientation="horizontal"
            android:paddingLeft="20dp"
            android:paddingRight="20dp">
    
            <TextView
                android:id="@+id/gasguardset_notice_sure"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginRight="10dp"
                android:layout_weight="1"
                android:background="@drawable/shape_tolerance"
                android:gravity="center"
                android:paddingBottom="8dp"
                android:paddingTop="8dp"
                android:text="是"
                android:textColor="@color/white" />
    
            <TextView
                android:id="@+id/gasguardset_notice_cancle"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:layout_weight="1"
                android:background="@drawable/shape_tolerance"
                android:gravity="center"
                android:paddingBottom="8dp"
                android:paddingTop="8dp"
                android:text="否"
                android:textColor="@color/white" />
        </LinearLayout>
    
    </RelativeLayout>
    
    <ImageView  //美工给定的图片,这个位置很关键(系统绘画是从最外表画透明,然后画最外表包裹的白色部分,最后将图片叠加在白色内容上面)
        android:id="@+id/gasgauard_notice_top"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:adjustViewBounds="true"
        android:src="@drawable/gasguardset_notice2" />
    

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

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料