Inside a RelativeLayout
, you can set the child views with alignParentTop
attribute to align both views at the top of the parent view and also use android:includeFontPadding
which is default to true
and allows the TextView
to automatically make some space for other languages than English (such as French for the accents) as follows:
<RelativeLayout
android:id="@+id/FullPriceInForeignLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="20"
android:background="@drawable/bck_price_foreign"
android:gravity="center"
android:paddingBottom="@dimen/home_foreign_margin"
android:paddingTop="@dimen/home_foreign_margin"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp" >
<TextView
android:id="@+id/currencyForeign"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:includeFontPadding="false"
android:text="USD"
style="@style/SmallWhiteTextViewWithShadow"
android:background="@color/orange" />
<TextView
android:id="@+id/valueInLocal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:includeFontPadding="false"
android:layout_marginLeft="@dimen/currency_price_margin"
android:layout_toRightOf="@id/currencyForeign"
android:text="0.00"
android:background="@color/orange"
style="@style/BigWhiteTextViewWithShadow" />
</RelativeLayout>
Here you can find perfect workarouds (as a Custom TextView
or a negative margins).