I am having two TextView
in LinearLayout
.
<LinearLayout
android:layout_marginTop="-10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/product_discounted_price"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/activity_vertical_margin"
android:layout_marginEnd="@dimen/margin_between_prices"
android:drawablePadding="5dp"
android:gravity="center_vertical"
android:text="AED200000000.00"
android:textColor="@color/black"
android:textSize="@dimen/font_size_sub_normal"
android:visibility="visible" />
<TextView
android:id="@+id/product_unit_price"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/activity_vertical_margin"
android:drawablePadding="5dp"
android:gravity="center_vertical"
android:text="AED200000000000.00"
android:textSize="@dimen/font_size_emphasized"
android:visibility="visible" />
</LinearLayout>
I want something like if 2nd TextView doesnt come in single line than it should shift to second line.
Issue is :
With SingeLine=true
With maxLine=1
What I want :
change
android:orientation="horizontal"
to
android:orientation="vertical"
and also add maxline and singleline to textView
It is easy put your text views in a RelativeLayout
and all you need to set layout_above
or layout_bottom
for your TextViews or you can change orientation:vertical
and then the gravity works. You can also set layout_gravity
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.