首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >设计布局大纲

设计布局大纲
EN

Stack Overflow用户
提问于 2013-08-22 07:02:29
回答 2查看 327关注 0票数 0

问题是:LinearLayout必须有一个不同的背景(白色颜色)和一个深色的轮廓。

代码语言:javascript
复制
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
    android:shape = "rectangle">
  <corners
      android:radius="2dp"
      android:topRightRadius="0dp"
      android:bottomRightRadius="0dp"
      android:bottomLeftRadius="0dp" />
  <stroke
      android:width="1dp"
      android:color="#000000" />

</shape>

我尝试过的是:下面的代码在布局文件中被称为"android:background"元素。这样做并不允许我的LinearLayout有我想要的白色背景,但是获得了黑暗的轮廓。对我如何做到这两点有什么想法吗?(帮助:)

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-08-22 07:28:22

你也可以试试这个

代码语言:javascript
复制
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
    android:shape = "rectangle">
  <corners
      android:radius="2dp"
      android:topRightRadius="0dp"
      android:bottomRightRadius="0dp"
      android:bottomLeftRadius="0dp" />
  <stroke
      android:width="1dp"
      android:color="#000000" />
  <gradient android:startColor="#FFFFFF"
    android:endColor="#FFFFFF"
    android:angle="90"/>

</shape>
票数 1
EN

Stack Overflow用户

发布于 2013-08-22 07:17:01

将您的LinearLayout放在FrameLayout中。给FrameLayout黑色背景。给LinearLayout的白色背景。将LinearLayout's边距设置为1dp

代码语言:javascript
复制
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@android:color/black" >

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_margin="1dp"
        android:background="@android:color/white" >

        ....
        ....

    </LinearLayout>

</FrameLayout>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18373734

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档