0

So I have a xml layout file with a relativelayout that has a few buttons (8 of them housed in a linear layout). Anchored at the top of this layout is a textview. The text in this textview is changed when you click on of the buttons which is what I set up programmatically, but when the text changes it rearranges the whole layout and thats too much for the user to have going on. I know it is because my textview is set to wrap_content but thats the best way I can account for the multiple screens.

Is there any way the layout can be set so that when the textview changes the amount of text it won't change the rest of the layout AND will still be dynamic enough to fit all the screen sizes for android users?

Here's my layout and thanks so much for any help!!!!

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/RelativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="${relativePackage}.${activityClass}" >

<TextView
    android:id="@+id/titleText"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_marginTop="15dp"
    android:layout_marginBottom="15dp"
    android:gravity="center"
    android:paddingLeft="5dp"
    android:paddingRight="5dp"
    android:text="Here is a really long sentance about some ish so that i can see exactly How  Much till it g"
    android:textAllCaps="true" />

<LinearLayout
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    android:layout_centerVertical="true">

    <TableRow
        android:id="@+id/tableRow1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:weightSum="2"
        android:layout_centerInParent="true"
        android:layout_below="@+id/titleText">

        <Button
            android:id="@+id/IdentityButton"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content"
            android:text="@string/List_Identity" />

        <Button
            android:id="@+id/ConnectionsButton"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content"
            android:text="@string/List_Connections" />
    </TableRow>

    <TableRow
        android:id="@+id/tableRow2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:layout_marginTop="5dp"
        android:weightSum="2"
        android:layout_below="@+id/tableRow1" >

        <Button
            android:id="@+id/ResourcesButton"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="@string/List_Resources" />

        <Button
            android:id="@+id/SkillsButton"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content"
            android:text="@string/List_Skills" />
    </TableRow>

    <TableRow
        android:id="@+id/tableRow3"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:layout_marginTop="5dp"
        android:weightSum="2"
        android:layout_below="@+id/tableRow2" >

        <Button
            android:id="@+id/InterestsButton"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content"
            android:text="@string/List_Interests" />

        <Button
            android:id="@+id/ResponsibilitiesButton"
           android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content"
            android:text="@string/List_Responsibilities" />
    </TableRow>

    <TableRow
        android:id="@+id/tableRow4"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:layout_marginTop="5dp"
        android:weightSum="2"
        android:layout_below="@+id/tableRow3" >

        <Button
            android:id="@+id/BeliefsButton"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content"
            android:text="@string/List_Beliefs" />

        <Button
            android:id="@+id/DirectionButton"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content"
            android:text="@string/List_Direction" />
    </TableRow>
</LinearLayout>

<Button
    android:id="@+id/ListNext"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentEnd="true"
    android:text="Next" />

<ImageButton
    android:contentDescription="@string/WhereHelpContentDesc"
    android:id="@+id/ListHelpButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:layout_alignParentBottom="true"
    android:src="@android:drawable/btn_star" />

KellysOnTop23
  • 1,325
  • 2
  • 15
  • 34

1 Answers1

1

So, in this case, from a UX perspective, I can't even imagine how this would work visually.

The best thing you can do here I think would make that textview shrink as it reaches its bounds (just the text, not the entire view).

Try using this textview to achieve that and let me know:

https://stackoverflow.com/a/5535672/1154026

Community
  • 1
  • 1
Vic Vuci
  • 6,993
  • 6
  • 55
  • 90
  • I figured it was a long shot, thanks for your help anyway! i ended up solving the issue by just making all the strings that would change the textview to be about the same amount of words. Its ghetto but hey, it gets the job done....i hope – KellysOnTop23 May 12 '15 at 16:19
  • Try the one I posted! Its very easy to implement and would look WAY better. Trust me :) – Vic Vuci May 12 '15 at 17:29