У меня есть TextView
, высота которого wrap_content
. Наверху и внизу находится линия TextView
. Мне было интересно, если в любом случае будет изменяться размер линий в зависимости от высоты, определяемой оберткой текста. См. Изображение ниже.Возможно ли, чтобы высота вида реагировала на размер другого вида динамически?
Примечание: фон TextView
прозрачный. поэтому я не могу просто провести линию и использовать FrameLayout
.
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/margin_connection_line"
android:layout_marginBottom="@dimen/margin_connection_line"
>
<View
android:id="@+id/top_vertical_line"
android:layout_above="@+id/connection_text"
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@color/font_white"
/>
<TextView
android:id="@+id/connection_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/margin_larger"
android:layout_marginRight="@dimen/margin_larger"
android:layout_gravity="center"
android:padding="@dimen/margin_larger"
android:gravity="center"
android:textColor="@color/font_white"
android:background="@drawable/connection_white_border"
android:text="@string/sample_text"
/>
<View
android:id="@+id/bottom_vertical_line"
android:layout_below="@+id/connection_text"
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@color/font_white"
/>
</RelativeLayout>
К сожалению, ты прав! Благодаря! –