Loading [MathJax]/jax/input/TeX/config.js
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >我需要xml设计指南

我需要xml设计指南
EN

Stack Overflow用户
提问于 2020-07-28 21:37:32
回答 1查看 138关注 0票数 0

所需的设计是一个可滚动的屏幕,其中有3到4个几乎相似的块:

这就是我一直在尝试的

代码语言:javascript
运行
AI代码解释
复制
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    xmlns:custom="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:fillViewport="true"
    android:background="@color/colorWhite"
    tools:context=".MainActivity">
       <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <com.santalu.diagonalimageview.DiagonalImageView
            android:id="@+id/image"
            android:layout_width="match_parent"
            android:layout_height="350dp"
            android:scaleType="centerCrop"
            android:src="@drawable/demo"
            app:di_borderColor="#FF5722"
            app:di_borderEnabled="false"
            app:di_direction="left"
            app:di_overlap="60dp"
            app:di_position="bottom" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_margin="16dp"
            android:text="Maternity care plan"
            android:textColor="#040303"
            android:textSize="20sp" />

        <TextView
            android:id="@+id/tv2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="240dp"
            android:text="Maternity care plan"
            android:textColor="#050505"
            android:textSize="20sp" />

        <com.example.diagnalimageview.DividerView
            android:id="@+id/line1"
            android:layout_width="4dp"
            android:layout_height="150dp"
            android:layout_below="@+id/tv2"
            android:layout_centerHorizontal="true"
            android:layerType="software"
            custom:color="#050505"
            custom:dashGap="2dp"
            custom:dashLength="5dp"
            custom:dashThickness="1dp"
            custom:orientation="vertical" />

       
        <!-- A CardView that contains a TextView -->


        <androidx.constraintlayout.widget.ConstraintLayout
            android:id="@+id/pregnancy_plane_container"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_below="@id/line1"
            android:layout_centerHorizontal="true"
            android:layout_marginStart="8dp"
            android:layout_marginEnd="8dp">
            <RelativeLayout
                android:id="@+id/circle_progress_container"
                android:layout_width="75dp"
                android:layout_height="75dp"
                android:translationZ="90dp"

                custom:layout_constraintEnd_toEndOf="parent"
                custom:layout_constraintStart_toStartOf="parent"
                custom:layout_constraintTop_toTopOf="parent">
                <com.timqi.sectorprogressview.ColorfulRingProgressView
                    android:id="@+id/circle_progress"
                    android:layout_width="75dp"
                    android:layout_height="75dp"
                    app:bgColor="#e1e1e1"
                    app:fgColorEnd="#5900FF"
                    app:fgColorStart="#5900FF"
                    app:percent="0"
                    app:startAngle="0"
                    app:strokeWidth="8dp"
                    android:background="@color/colorWhite"/>
                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="0%"
                    android:layout_centerInParent="true"/>

            </RelativeLayout>
            <!--determine center to circular shape-->
            <Button
                android:id="@+id/dummy_view"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Dummy view"
                android:visibility="gone"
                app:layout_constraintBottom_toBottomOf="@id/circle_progress_container"
                app:layout_constraintEnd_toEndOf="@id/circle_progress_container"
                app:layout_constraintStart_toStartOf="@+id/circle_progress_container"
                app:layout_constraintTop_toTopOf="@id/circle_progress_container"
                tools:ignore="HardcodedText" />



            <androidx.cardview.widget.CardView
                android:id="@+id/pregnancy_plane"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                app:cardElevation="12dp"
                app:cardUseCompatPadding="true"
                android:translationY="-20dp"
                app:layout_constraintTop_toBottomOf="@+id/dummy_view"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintEnd_toEndOf="parent"
                card_view:cardBackgroundColor="@color/colorPrimary"
                card_view:contentPadding="1dp">


    
                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:orientation="vertical"
                        android:background="@color/colorWhite">

                        <TextView
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="48dp"
                            android:gravity="center"
                            android:text="PLAN YOUT PREGNANCY\nTHE WAY YOU WANT"
                            android:textSize="20sp" />

                        <ImageView
                            android:layout_width="100dp"
                            android:layout_height="100dp"
                            android:layout_gravity="center"
                            android:layout_margin="32dp"
                            android:src="@mipmap/ic_launcher" />

                        <Button
                            android:layout_width="match_parent"
                            android:layout_height="wrap_content"
                            android:background="@color/colorPrimary"
                            android:text="PLANNING MY PREGNANCY"
                            android:textSize="20sp" />

                    </LinearLayout>
              
            </androidx.cardview.widget.CardView>





        </androidx.constraintlayout.widget.ConstraintLayout>

        <com.example.diagnalimageview.DividerView
            android:id="@+id/line2"
            android:layout_width="4dp"
            android:layout_height="150dp"
            android:layout_below="@+id/pregnancy_plane_container"
            android:layout_centerHorizontal="true"
            android:translationY="-36dp"
            android:layerType="software"
            custom:color="#050505"
            custom:dashGap="2dp"
            custom:dashLength="5dp"
            custom:dashThickness="1dp"
            custom:orientation="vertical" />

        <androidx.constraintlayout.widget.ConstraintLayout
            android:id="@+id/container"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_below="@id/line2"
            android:layout_centerHorizontal="true"
            android:layout_marginEnd="8dp"
            android:layout_marginBottom="8dp">

            <RelativeLayout
                android:id="@+id/circle_progress_container2"
                android:layout_width="75dp"
                android:layout_height="75dp"
                android:translationZ="90dp"

                custom:layout_constraintEnd_toEndOf="parent"
                custom:layout_constraintStart_toStartOf="parent"
                custom:layout_constraintTop_toTopOf="parent">

                <com.timqi.sectorprogressview.ColorfulRingProgressView
                    android:id="@+id/pregnancy_choices_progress"
                    android:layout_width="75dp"
                    android:layout_height="75dp"
                    android:background="@color/colorWhite"
                    app:bgColor="#e1e1e1"
                    app:fgColorEnd="#5900FF"
                    app:fgColorStart="#5900FF"
                    app:percent="0"
                    app:startAngle="0"
                    app:strokeWidth="8dp" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerInParent="true"
                    android:text="0%" />

            </RelativeLayout>
            <!--determine center to circular shape-->
            <Button
                android:id="@+id/dummy_view2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Dummy view"
                android:visibility="gone"
                app:layout_constraintBottom_toBottomOf="@id/circle_progress_container2"
                app:layout_constraintEnd_toEndOf="@id/circle_progress_container2"
                app:layout_constraintStart_toStartOf="@+id/circle_progress_container2"
                app:layout_constraintTop_toTopOf="@id/circle_progress_container2"
                tools:ignore="HardcodedText" />


            <androidx.cardview.widget.CardView
                android:id="@+id/pregnancy_choices"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:translationY="-20dp"
                app:cardElevation="12dp"
                app:cardUseCompatPadding="true"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toBottomOf="@+id/dummy_view2"
                card_view:cardBackgroundColor="@color/colorPrimary"
                card_view:contentPadding="1dp">


                <!--<androidx.cardview.widget.CardView

                    android:id="@+id/card_view"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    app:layout_constraintTop_toBottomOf="@+id/dummy_view">-->

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="@color/colorWhite"
                    android:orientation="vertical">

                    <TextView
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="48dp"
                        android:gravity="center"
                        android:text="PLAN YOUT PREGNANCY\nTHE WAY YOU WANT"
                        android:textSize="20sp" />

                    <ImageView
                        android:layout_width="100dp"
                        android:layout_height="100dp"
                        android:layout_gravity="center"
                        android:layout_margin="32dp"
                        android:src="@mipmap/ic_launcher" />

                    <Button
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:background="@color/colorPrimary"
                        android:text="PLANNING MY PREGNANCY"
                        android:textSize="20sp" />

                </LinearLayout>
                <!-- </androidx.cardview.widget.CardView>-->
            </androidx.cardview.widget.CardView>


        </androidx.constraintlayout.widget.ConstraintLayout>


    </RelativeLayout>

</androidx.core.widget.NestedScrollView>

现在的问题是块视图层次结构是

代码语言:javascript
运行
AI代码解释
复制
ConstraintLayout
     RelativeLayout.            -for progress chart
     Button(dummyview)          -to determine center of progress chart
     cardview                   -to give elevated look I used compact padding 12dp

填充在约束布局和cardview之间形成了底部空间。所以当我试着在第一块和第二块之间画垂直线的时候。第一行是比我用translationY= -12dp修复的块低12dp,但现在垂直线正在接触第二个块。

我的输出:

EN

回答 1

Stack Overflow用户

发布于 2020-08-10 19:56:53

我设法解决了这个问题,用LinearLayout替换了cardview,并对LinearLayout使用了可绘制的阴影,使其看起来像cardview。

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

https://stackoverflow.com/questions/63143150

复制
相关文章
【Hive】从长格式表到宽格式表的转换
使用sql代码作分析的时候,几次遇到需要将长格式数据转换成宽格式数据,一般使用left join或者case when实现,代码看起来冗长,探索一下,可以使用更简单的方式实现长格式数据转换成宽格式数据。
1480
2019/05/22
2.4K0
深入Python数据分析:数据由长格式变为宽格式
melt()的逆操作在Pandas中对应为 pivot(),它也是一个设计上的顶层函数,工程位置如下:
double
2019/05/27
1.4K0
Facebook泄漏升级:受影响用户增长到8700万
美国时间 4 月 4 日,Facebook 的首席技术官 Mike Schroepfer 在官网发布声明,描述了数据泄露事件之后 Facebook 近期采取的一系列加强隐私保护的措施。但他同时也表示,Cambridge Analytica 从 Facebook 获取的用户信息高达 8700 万,比之前的 5000 万多出不少。其中,超过 80% 的用户都是美国人。
FB客服
2018/07/30
3710
Facebook泄漏升级:受影响用户增长到8700万
世界上最长寿的泡泡:加点东西,生命延长到465天
来源:机器之心本文共2200字,建议阅读5分钟和普通泡泡1分钟的短暂美丽相比,这个泡泡的生命足足延长了20万倍。 十多年前,科幻作家刘慈欣写过一个有趣的小故事。 故事的主人公是一个叫圆圆的小女孩,她的父母为改善大西北的生态环境奉献了整个青春,但由于供水成本过高,他们辛辛苦苦建立起来的城市——丝路市依然难逃废弃的命运。 圆圆本人的梦想则比较简单,她只想吹出一个大大的泡泡。对此,圆圆的爸爸忧心忡忡,因为他认为女儿追求的是美丽、新奇而虚幻的东西。长大之后,圆圆凭借自己学到的东西创立了一个资产数亿的公司,但她的梦想
数据派THU
2022/03/04
2630
世界上最长寿的泡泡:加点东西,生命延长到465天
故事的主人公是一个叫圆圆的小女孩,她的父母为改善大西北的生态环境奉献了整个青春,但由于供水成本过高,他们辛辛苦苦建立起来的城市——丝路市依然难逃废弃的命运。
机器之心
2022/02/23
1870
世界上最长寿的泡泡:加点东西,生命延长到465天
工程师成长到最后,最重要的到底是什么?
文章目录 一、前言 二、主要内容 三、总结 🍉 CSDN 叶庭云:https://yetingyun.blog.csdn.net/ ---- 一、前言 工程师成长到最后最重要的到底是什么? 原文来源:https://chinese.catchen.me/2023/02/engineer-career-growth-endgame.html。这篇文章讨论了一个关于工程师成长的问题,即工程师成长到最后最重要的是什么。对于新人来说,他们往往认为自己需要更多的知识才能变得更加优秀。然而,随着时间的推移,“隐性知识”
叶庭云
2023/03/24
2610
工程师成长到最后,最重要的到底是什么?
R基础|do包(6):长型数据转宽型数据
如果你前面学习了宽型数据转长型数据的3节内容,那么这节内容你看起来就非常简单了,所以我十分推荐你想看一下前3节的内容。
Chris生命科学小站
2023/02/28
4540
R基础|do包(6):长型数据转宽型数据
麦肯锡预测:2020年物联网市场将增长到37亿美元
T客汇官网:tikehui.com 原文作者 | Louis Columbus 译者 | 李哲 贝恩公司(Bain)预计,到2020年,提供硬件、软件和综合解决方案的IoT供应商,年收益将超过4,7
人称T客
2018/03/26
1.3K0
麦肯锡预测:2020年物联网市场将增长到37亿美元
R包reshape2,轻松实现长、宽数据表格转换
本文翻译自外文博客,原文链接:https://seananderson.ca/2013/10/19/reshape/
生信宝典
2018/12/07
8.2K0
R包reshape2,轻松实现长、宽数据表格转换
R包reshape2 |轻松实现长、宽数据表格转换
https://seananderson.ca/2013/10/19/reshape/
生信宝典
2019/10/24
12.1K0
如何识别出轮廓准确的长和宽
对于这样 的轮廓分析,标明出来的1和2明显是错误的。但是除了minAreaRect之外,已经没有更解近一步的方法。也尝试首先对轮廓进行凸包处理,再查找外接矩形,效果同样不好。
OpenCV学堂
2018/09/29
2.1K0
如何识别出轮廓准确的长和宽
与英特尔抢市场,英伟达的数据中心业务能增长到多大?
翻译 | AI科技大本营 参与 | shawn 在新型视频游戏、机器学习软件革命、基于 CPU-GPU 混合架构的大型超级电脑的扩建、比特币和以太坊等数字加密货币的挖掘的四重加持下,英伟达正在创下新的收入、利润和市值记录。 英伟达最新的 Volta 架构的 GPU 瞄准的是高性能计算(HPC)和 AI 计算,自推出之后其市场需求一直在激增。其之前推出的 Pascal 架构的 GPU 则瞄准的是游戏、工作站和数字加密货币挖掘。对英伟达而言,Pascal 既是一步好棋也是一步坏棋。不过坏棋最终也成为某种程度
AI科技大本营
2018/04/26
6600
与英特尔抢市场,英伟达的数据中心业务能增长到多大?
全球商学院院长到访腾讯互联网与社会研究院
10月25日上午,来自全球各地的24位商学院院长、27位北京大学商学院教授等60余人到访腾讯互联网与社会研究院,就互联网发展趋势、腾讯公司发展情况、研究院概况等等进行交流;研究院秘书长司晓博士、产业经
腾讯研究院
2018/03/13
8050
全球商学院院长到访腾讯互联网与社会研究院
R基础|do包(3):宽型数据转长型数据reshape_toLong(1)
我们测量三位小朋友1、2、3,在1岁、2岁、3岁时候的身高。数据如下:
Chris生命科学小站
2023/02/28
5210
R基础|do包(3):宽型数据转长型数据reshape_toLong(1)
公式我都懂,但为什么面积=长×宽?
每排5个,一共7排,所以是 5*7 = 35 个。所以长方形的面积就是35cm²。
用户7378374
2020/05/27
3.2K0
一辆特斯拉,长到一米八!硅谷IT男断腿增高,成医美狂魔?
---- 新智元报道   编辑:桃子 好困 【新智元导读】为了提升人格魅力,硅谷IT男「打断腿」做增高术,还欠下一屁股债。 为了定义「成功人士」,硅谷IT男纷纷做起了整形手术。 可「打断腿」都要搏一把,竟也成为这些精英人士的选择。 这不,一位45岁左右的网络工程师John Lovedale为了增高3英寸(约7.6cm),不惜一切代价从网上银行SoFi贷款7.5万美元去做增高术。 未来5年,他每个月还要分期1200美元来偿还手术费,但是他并不后悔。 Lovedale解释了自己为什么经历痛苦长达三个月的
新智元
2022/09/20
5360
一辆特斯拉,长到一米八!硅谷IT男断腿增高,成医美狂魔?
pandas中数据框的reshape操作
数据框的长宽转换对于熟悉R语言的朋友而言,应该不会陌生。使用ggplot2画图时,最常用的数据处理就是长宽转换了。在pandas中,也提供了数据框的长宽转换功能,有以下几种实现方式
生信修炼手册
2020/07/02
4.7K0
三大地产巨头发布半年报,碧桂园从高速增长到优质增长
近日,碧桂园、万科和恒大三大地产巨头相继公布2018年半年报。从合同销售额和营收增速来看,在去年成为行业老大后的碧桂园,继续领跑整个房地产市场。
罗超频道
2018/09/28
4740
DDD 中的几个困难问题
领域到底是什么? 对领域这个词的理解就是 DDD 入门的第一个难关。我们有时会被客户问到,领域到底是什么?首先要清晰地知道领域是什么,才能划分核心域、支撑域和通用域。换句话说,构成领域的要素是什么呢? 领域是一个非常抽象的词汇,我们需要先对其具象化。在英语的语境中,“Domain” 其实就是业务,指的是现实生活中的各种事务。处理税务、记账、售货记录等,这些都是领域。 于是,我们给领域下了一个定义: 领域(Domain)是业务相关知识的集合。 通俗来说,领域就是业务知识。业务有一些内在规则,存在专业性,比如财
ThoughtWorks
2022/07/18
4090
DDD 中的几个困难问题
点击加载更多

相似问题

使用多索引列展平DataFrame

31

将JSON数据展平到单独的列

10

将DIVs和SVG的图层展平到单个图像中

10

使用AutoMapper将数据从实体展平/取消展平到模型

10

将xml列展平为新列

10
添加站长 进交流群

领取专属 10元无门槛券

AI混元助手 在线答疑

扫码加入开发者社群
关注 腾讯云开发者公众号

洞察 腾讯核心技术

剖析业界实践案例

扫码关注腾讯云开发者公众号
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档