I want to add new textViews to my custom linear layout. But before the linear layout is drawn i want to check if it still fits without overlapping with the buttons on the right and if it would overlap i want to cut the text in my textView before drawing it.
my Layout
<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="60dp" >
<ImageButton
    android:id="@+id/b_settings"
    android:layout_width="50dp"
    android:layout_height="44dp"
    android:layout_alignParentRight="true"
    android:layout_margin="0dp"
    android:src="@drawable/watch_settings2x" />
<Button 
    android:id="@+id/b_test"
    android:layout_width="50dp"
    android:layout_height="44dp"
    android:layout_toLeftOf="@id/b_settings"
    />
<com.client.views.Breadcrump
    android:id="@+id/ll_breadcrump"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:orientation="horizontal" />
</RelativeLayout>
my flow looks like this, first i add a new TextView to my custom View.
this.addView(TextView, position);
i have implemented the following GlobalLayoutListener which is called before the custom View is drawn, but the width is allready available:
@Override
            public void onGlobalLayout() {
                cutBreadcrump();
            }
Then i first get the available Space for my Breadcrump (custom View)
 int fragmentWidth = getView().getWidth();
         int widthButtons = mIBSettings.getWidth() + mBTest.getWidth();
         int spaceBreadcrump = fragmentWidth - widthButtons;
Next i'm cutting Chars from my new added TextView as and check the new width
CharSequence text = textView.get(0).getText();
                text = text.subSequence(0, text.length() - 1);
                textView.get(0).setText(text);
but this is my Problem. The width doesn't change after changing the Text.
mElements.get(0).getWidth();
I also tried the paint.measureText(string); method to get the width of my TextView but it was always much to long. Maybe this method does something different then what i expected ...
So my Problem is in short how to get the new width of an view after changing it's text before drawing the view