-3

I'm stuck with a small problem in my listview. I tried several things like adding padding or changing the margins. But this didn't fix my problem. Words keep getting cut of in the last rule.

enter image description here

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="match_parent"
    android:divider="?android:dividerVertical"
    android:showDividers="middle"
    android:dividerPadding="8dp">



    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:id="@+id/violationstitlebar"

        >


        <TextView
            android:layout_width="@dimen/violation_list_col1"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:text="@string/resTaskviolPos"/>

        <TextView
            android:layout_width="@dimen/violation_list_col2"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:text="@string/resTaskviolDescriptionNLB"/>

        <TextView
            android:layout_width="@dimen/violation_list_col3"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceSmall"
            />

        <TextView
            android:layout_width="@dimen/violation_list_col4"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:text="@string/resTaskDescriptionFRB" />

        <TextView
            android:layout_width="@dimen/violation_list_col5"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceSmall"
            />

        <TextView
            android:layout_width="@dimen/violation_list_col6"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:text="@string/resTaskviolBLS"/>

        <TextView
            android:layout_width="@dimen/violation_list_col7"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:text="@string/resTaskviolRepeat"
            />

        <TextView
            android:layout_width="@dimen/violation_list_col8"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceSmall"

            />


    </LinearLayout>


    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:divider="?android:dividerVertical"
        android:showDividers="middle"
        android:dividerPadding="8dp"
        >


        <TextView
            android:layout_width="@dimen/violation_list_col1"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:text=""
            android:id="@+id/tvViolListPosition"
            android:paddingLeft="10dp"
            android:paddingBottom="10dp"/>
        <TextView
            android:layout_width="@dimen/violation_list_col2"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:text=""
            android:id="@+id/tvViolListDescription"
            android:layout_weight="1"
            android:maxLines="4"
            />
        <ImageButton
            android:layout_width="@dimen/violation_list_col3"
            android:layout_height="50dp"
            android:id="@+id/ibViolListEditDesc"
            />
        <TextView
            android:layout_width="@dimen/violation_list_col4"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:text=""
            android:id="@+id/tvViolListDescriptionFRB"
            android:layout_weight="1"
            />
        <ImageButton
            android:layout_width="@dimen/violation_list_col5"
            android:layout_height="50dp"
            android:id="@+id/ibViolListEditDescFRB"
            />
        <Spinner
            android:layout_width="@dimen/violation_list_col6"
            android:layout_height="wrap_content"
            android:id="@+id/spViolListConclusion"
            style="?android:dropDownSpinnerStyle"/>
        <EditText
            android:layout_width="@dimen/violation_list_col7"
            android:layout_height="wrap_content"
            android:textAppearance="?android:attr/textAppearanceMedium"
            android:id="@+id/etViolListCounter"
            android:inputType="number"
            />
        <ImageButton
            android:layout_width="@dimen/violation_list_col8"
            android:layout_height="50dp"
            android:id="@+id/ibViolListDelete"
            />


    </LinearLayout>


</LinearLayout>

Does anyone have an idea how to fix this?

kind regards,

Tim

4
  • Can you provide xml of your item please ? May 26, 2015 at 12:07
  • Show your XML. And trim the image too May 26, 2015 at 12:08
  • You can put textView in scrollview or you can use maxLines for TextView.
    – Piyush
    May 26, 2015 at 12:10
  • XML added and picture trimmed :)
    – data2info
    May 26, 2015 at 12:11

3 Answers 3

0

give some limitaion to charaters ,while adding the content of your NLB

maxlines, minimum lines

<EditText
                            android:id="@+id/AddressEdittext"
                            android:layout_width="fill_parent"
                            android:layout_height="wrap_content"
                            android:layout_below="@+id/textView4"
                            android:layout_centerHorizontal="true"
                            android:layout_centerVertical="true"
                            android:layout_marginTop="15dp"
                            android:background="@drawable/retangle_shape"
                            android:gravity="top|left"
                            android:hint="Type  Here..."
                            android:inputType="textMultiLine"
                            android:lines="5"
                            android:maxLines="10"
                            android:minLines="5"
                            android:paddingBottom="5dp"
                            android:paddingLeft="@dimen/padding"
                            android:paddingRight="@dimen/padding"
                            android:paddingTop="5dp"
                            android:scrollbars="vertical" >
                        </EditText>
0

Try using this property also with some padding bottom:

 android:includeFontPadding="false"

And:

android:baselineAligned="false"
0

I think you can solve it with layout_weight attribute.

More info on layout_weight can be found on: http://ugia.io/2012/01/19/android-linearlayout-distribution-explained-weight-and-sizes/

http://developer.android.com/guide/topics/ui/layout/linear.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.