我需要放置the date as the title of a Listview
,但是inside a bubble
,有人可以告诉我该怎么做。
以下是放置date as a title:
readFechaActual();
TextView textView = new TextView(context);
textView.setText(stringDate);
listView.addHeaderView(textView);
通过此代码,我得到了:
但是我需要这样的标题:
以下是创建气泡的文件:drawable/time_message.xml:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/SALMON" />
<corners android:radius="20dp" />
答案 0 :(得分:0)
您可以创建这样的布局
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/round_corner_white"
>
<TextView
android:id="@+id/tv_search_what"
style="@style/gray_12_l"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
/>
</RelativeLayout>
将此布局居中对齐
round_corner_white
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/white"/>
<stroke android:width="0.5dp" android:color="@color/blue" />
<corners android:radius="@dimen/_20sdp"/>
<corners
android:bottomLeftRadius="@dimen/_20sdp"
android:bottomRightRadius="@dimen/_20sdp"
android:topLeftRadius="@dimen/_20sdp"
android:topRightRadius="@dimen/_20sdp" />
</shape>