0
我在一個佈局中有一個自定義聊天氣泡,另一個佈局中有一個進度欄。我知道如何將整個佈局包含在另一個佈局中。但是我想在另一個佈局中包含一個視圖,即進度條。如何在另一個佈局中包含進度欄視圖
這是我的聊天氣泡佈局。
<RelativeLayout
android:id="@+id/message_content_box"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="0dp">
<com.chatbubble.BubbleFrameLayout
android:id="@+id/message_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:paddingBottom="10dp"
android:paddingLeft="10dp"
android:paddingRight="18dp"
android:paddingTop="10dp"
custom:bubbleColor="@color/theme_light"
custom:bubbleCornerRadius="6dp"
custom:bubbleArrowType="standard"
custom:bubbleArrowPosition="right"
custom:bubbleArrowAlign="end"
custom:bubbleArrowWidth="8dp"
custom:bubbleArrowHeight="16dp"
custom:bubbleArrowOffset="-14dp">
<include layout="@layout/message_content"/>
</com.chatbubble.BubbleFrameLayout>
<ImageView
android:id="@+id/message_status"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignBottom="@+id/message_content"
android:layout_alignLeft="@+id/message_content"
android:layout_marginBottom="-10dp"
android:layout_marginLeft="-10dp"
android:contentDescription="@string/message_status_content_description"
android:src="@drawable/ic_message_success" />
</RelativeLayout>
以下是我的佈局與進度。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/message_file_controls"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/message_file_controls1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" >
<TextView
android:id="@+id/file_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="7dp"
android:ellipsize="end"
android:singleLine="true"
android:text="IMG-55122.jpg (1.5M)"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textScaleX="0.5" />
<ProgressBar
android:id="@+id/file_progress"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="160dp"
android:layout_height="3dip"
android:layout_alignParentBottom="true"
android:layout_alignTop="@+id/file_status"
android:layout_centerInParent="true"
android:layout_gravity="top"
android:background="@drawable/ab_bottom_solid_example"
android:max="100"
android:maxWidth="220dp"
android:progress="0"
android:progressDrawable="@drawable/message_ft_progress_bar" />
<TextView
android:id="@+id/file_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/file_title"
android:layout_marginTop="2dp"
android:text="0%"
android:textAppearance="?android:attr/textAppearanceSmall" />
請幫忙。