Android时间轴视图布局问题

Android时间轴视图布局问题,android,android-layout,Android,Android Layout,我在应用程序中创建一个时间线视图。在布局中,两点之间的间距过大 我做了一次回收检查。我使用此布局作为其项目。下面是我当前的输出和代码 我的输出: 预期输出:忽略此颜色。我只想看到这样的景色 我的代码: 如果您需要任何其他代码,请告诉我。请提出一些建议。谢谢大家! 这里,我没有为它做RecycleView,我只是复制粘贴多行代码 在这里,我没有为它做RecycleView,我只是为多行复制粘贴代码 您可以按照@Evin1_的建议使用负边距 对于第一个项目可见性问题,这可能太过手动,但您可以为Rec

我在应用程序中创建一个时间线视图。在布局中,两点之间的间距过大

我做了一次回收检查。我使用此布局作为其项目。下面是我当前的输出和代码

我的输出:

预期输出:忽略此颜色。我只想看到这样的景色

我的代码:


如果您需要任何其他代码,请告诉我。请提出一些建议。谢谢大家!

这里,我没有为它做RecycleView,我只是复制粘贴多行代码


在这里,我没有为它做RecycleView,我只是为多行复制粘贴代码


您可以按照@Evin1_的建议使用负边距


对于第一个项目可见性问题,这可能太过手动,但您可以为RecyclerView提供padding top。

您可以按照@Evin1的建议使用负边距


对于第一个项目可见性问题,这可能过于手动,但您可以将padding top设置为RecyclerView。

请检查此项:@methantoksoy它正在工作。。但它也给了第一个项目的装饰,所以它将被削减。对此有什么建议吗?这太手动了,但你可以在recyclerview中添加填充物。@MetehanToksoy是的,非常感谢!它解决了我的问题。请为未来的访客发布一个答案,我会标记出来,不客气。我将此作为答案发布。请检查此:@MetehanToksoy它正在工作。。但它也给了第一个项目的装饰,所以它将被削减。对此有什么建议吗?这太手动了,但你可以在recyclerview中添加填充物。@MetehanToksoy是的,非常感谢!它解决了我的问题。请为未来的访客发布一个答案,我会标记出来,不客气。我将此作为答案发布。您的代码是完美的,但不符合我的要求。事实上,我希望文本视图布局指向点而不是点的中间。任何建议请在文本视图到视图之间留出空白。是的,我告诉你,我希望整个视图图像和文本位于点的右侧,而不是视图的右侧。。它应该从点开始。你明白我想要解释的吗?你的代码是完美的,但不符合我的要求。事实上,我希望文本视图布局指向点而不是点的中间。任何建议请在文本视图到视图之间留出空白。是的,我告诉你,我希望整个视图图像和文本位于点的右侧,而不是视图的右侧。。应该从点开始。你明白我要解释的吗?
<?xml version="1.0" encoding="utf-8"?>
    <layout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto">

        <data>

            <import type="android.view.View" />

            <variable
                name="obj"
                type="com.smartcompliant.model.ComplaintProgressModel" />
        </data>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="100dp"
            android:orientation="vertical">

            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal">

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="20dp"
                    android:layout_marginTop="25dp"
                    android:orientation="vertical">

                    <TextView
                        android:background="@drawable/complaint_status"
                        android:layout_width="20dp"
                        android:layout_height="20dp"
                        android:textColor="@color/colorGreen" />


                    <View
                        android:layout_width="2dp"
                        android:layout_height="match_parent"
                        android:layout_gravity="center_horizontal"
                        android:background="@color/colorPrimaryCompHistory"
                        android:layout_marginTop="@dimen/margin_5"
                        android:visibility="@{obj.isLast ? View.VISIBLE : View.GONE}" />
                </LinearLayout>



                <LinearLayout
                    android:layout_width="0dp"
                    app:cardElevation="@dimen/margin_5"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/margin_15"
                    android:layout_weight="1"
                    android:background="@drawable/line_box"
                    android:orientation="horizontal">


                    <ImageView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:backgroundTint="@color/colorTextHint"
                        android:layout_marginLeft="@dimen/margin_5"
                        android:layout_gravity="center_vertical"
                        android:src="@drawable/ic_left" />

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="@dimen/margin_10"
                        android:orientation="vertical">

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@{obj.title1}"
                            android:textStyle="bold"
                            android:layout_marginTop="@dimen/margin_5"
                            android:textSize="@dimen/font_14"
                            android:padding="@dimen/margin_5"
                            android:textColor="@color/colorTextHint" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginTop="@dimen/margin_5"
                            android:layout_marginLeft="@dimen/margin_5"
                            android:text="@{obj.title2}"
                            android:layout_marginBottom="@dimen/margin_10"
                            android:textSize="@dimen/font_12"
                            android:textColor="@color/colorTextHint" />


                    </LinearLayout>


                </LinearLayout>


            </LinearLayout>

        </LinearLayout>
    </layout>
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="100dp"
    android:orientation="vertical">

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="20dp"
            android:id="@+id/ll_dots"
            android:orientation="vertical">

            <TextView
                android:layout_width="20dp"
                android:layout_height="20dp"
                 android:layout_marginTop="4dp"
                android:background="@drawable/drawable_btn_green"
                android:textColor="@color/colorPrimary" />


            <View
                android:layout_width="2dp"
                android:layout_height="match_parent"
                android:layout_gravity="center_horizontal"
                android:layout_marginTop="4dp"
                android:background="@color/colorPrimary"
                android:visibility="@{obj.isLast ? View.VISIBLE : View.GONE}" />
        </LinearLayout>


        <LinearLayout

            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="15dp"
            android:layout_weight="1"
            android:layout_toRightOf="@+id/ll_dots"
            android:id="@+id/ll_one"
            android:layout_centerInParent="true"
            android:background="@drawable/grey_round_rect"
            android:orientation="horizontal">


            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:layout_marginLeft="5dp"
                android:backgroundTint="@color/Green"
                android:src="@mipmap/ic_launcher" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:orientation="vertical">

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:padding="5dp"
                    android:text="@{obj.title1}"
                    android:textColor="@color/gray_dark"
                    android:textSize="14sp"
                    android:textStyle="bold" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="10dp"
                    android:layout_marginLeft="5dp"
                    android:layout_marginTop="5dp"
                    android:text="@{obj.title2}"
                    android:textColor="@color/gray_dark"
                    android:textSize="12sp" />


            </LinearLayout>


        </LinearLayout>


    </RelativeLayout>

</LinearLayout>