【问题标题】:Android New Message type recipient controlAndroid 新消息类型收件人控件
【发布时间】:2016-12-16 16:43:06
【问题描述】:

请问有谁知道如何复制/镜像新消息收件人/收件人栏功能?是否有可用的内置控件或小部件,还是我必须自定义构建?或者有没有可用的例子?我尝试了一些术语,但不确定我应该使用的确切术语是什么。使用了诸如“android message recipient bar”、“android message to bar”等术语,但没有返回对我有用的...

仍在建设中,但这就是目前的样子......

【问题讨论】:

  • 对我来说看起来像一个样式按钮
  • 对我来说看起来很 iOS 风格。虽然很容易制作

标签: android message


【解决方案1】:

您可以这样做,marginLeft="-1dp" 只是一种快速解决方案,可以避免创建只有一侧边框的形状。为了避免使用这种肮脏的解决方案:How to draw border on just one side of a linear layout?

layout.xml

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    >
    <Button
        android:layout_width="wrap_content"
        android:layout_height="40dp"
        android:text="Able John"
        android:textAllCaps="false"
        android:background="@drawable/background"
        />
    <Button
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:layout_marginLeft="-1dp"
        android:background="@drawable/background_right_corners"
        />

</LinearLayout>

可绘制/背景

<?xml version="1.0" encoding="utf-8"?>

<solid android:color="#fff"/>
<stroke android:width="1dp" android:color="#5000"/>
<corners
    android:bottomLeftRadius="5dp"
    android:topLeftRadius="5dp"
    />

</shape>

可绘制/background_right_corners

<?xml version="1.0" encoding="utf-8"?>

<solid android:color="#fff"/>
<stroke android:width="1dp" android:color="#5000"
    />
<corners
    android:bottomRightRadius="5dp"
    android:topRightRadius="5dp"
    />

【讨论】:

  • 感谢您的回复。当我将它们动态添加到 RelativeLayout 时,我不得不与布局作斗争,因为您在 XML 中设置的任何参数都不起作用,必须动态设置它们。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-02-29
  • 1970-01-01
  • 2022-08-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-07-27
相关资源
最近更新 更多