【问题标题】:Android - UI container with edgingAndroid - 带有边缘的 UI 容器
【发布时间】:2015-05-07 08:22:27
【问题描述】:

有人知道我如何在顶部左侧创建带有边缘和标签的容器吗?

示例:screenshots here

我尝试了背景图片,但在平板电脑上缩放时出错。

【问题讨论】:

    标签: android user-interface


    【解决方案1】:

    看来您是对的,并且图片中有带圆角的布局。为此,请使用如下代码:

    <?xml version="1.0" encoding="UTF-8"?>
    <shape xmlns:android="http://schemas.android.com/apk/res/android">
        <solid android:color="#FFFFFF"/>
        <stroke android:width="3dip" android:color="#B1BCBE" />
        <corners android:radius="10dip"/>
        <padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
    </shape>
    

    来源: How to make layout with rounded corners..?round corners with border color

    在这种情况下,您不会遇到缩放问题。

    【讨论】:

      【解决方案2】:

      您可以使用RelativeLayout 来放置带有描边和文本+ 按钮的背景容器。然后放一个TextView 属性android:layout_alignParentTop=true

      <RelativeLayout 
          ...>
      
          <LinearLayout
            ....
            android:background="@drawable/blue_stroke">
      
              //Text + Button
      
          </LinearLayout>
      
          <TextView 
             ...
             android:background="@android:color/white"
             android:layout_alignParentTop="true"/>
      
      </RelativeLayout>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2016-08-10
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-01-17
        • 1970-01-01
        相关资源
        最近更新 更多