How do I alignBaseline to bottom line of multi-line TextView?
You could accomplish this with RelativeLayout if you implement a custom TextView. Specifically, you could override TextView.getBaseline like so:
package mypackage.name;
// TODO: imports, etc.
public class BaselineLastLineTextView extends TextView {
// TODO: constructors, etc.
@Override
public int getBaseline() {
Layout layout = getLayout();
if (layout == null) {
return super.getBaseline();
}
int baselineOffset = super.getBaseline() - layout.getLineBaseline(0);
return baselineOffset + layout.getLineBaseline(layout.getLineCount()-1);
}
}
Then you would use your custom TextView inside a RelativeLayout as follows:
<mypackage.name.BaselineLastLineTextView
android:id="@+id/text_view_1"
<!-- TODO: other TextView properties -->
/>
<TextView
android:id="@+id/text_view_2"
android:layout_alignBaseline="@id/text_view_1"
<!-- TODO: other TextView properties -->
/>