Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dialog activity - text gets cut in android

I am trying a simple contacts app that displays all the phones etc. When I click on the contact name, it displays the contact numbers in a dialogue activity. I can see the name and numbers properly when I have less numbers.. But if I have more numbers the name part in the activity gets cut.. Please check the below screen shot.

Can you see that Joe David text and profile picture gets cut. The numbers are displayed properly as it is in listview hence I can scroll down or up to view all the numbers.

How to fix this? - This screen shot is from Nexus 5 but same on Nexus 4 / Galaxy nexus too.. I have tried it on these.. Not sure on other phones..

XML Details:

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

<LinearLayout
    android:id="@+id/LayoutContactNumber"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight=".20"
    android:background="@drawable/blackbg"
    android:gravity="left|center"
    android:orientation="horizontal" >

    <com.res.dese.number.ResizableImageView
        android:id="@+id/CImage"
        android:layout_width="120px"
        android:layout_height="120px"
        android:padding="5dp"
        android:scaleType="fitXY"
        android:src="@drawable/no_pic" />

    <TextView
        android:id="@+id/PhoneLabel"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ellipsize="marquee"
        android:freezesText="true"
        android:gravity="center|left"
        android:marqueeRepeatLimit="marquee_forever"
        android:paddingLeft="5dp"
        android:scrollHorizontally="true"
        android:singleLine="true"
        android:text="XXX"
        android:textColor="#2CABE2"
        android:textSize="30sp"
        android:textStyle="bold" />
</LinearLayout>

<ImageView
    android:id="@+id/whiteline"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:src="@drawable/whiteline" />

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight=".65"
    android:orientation="vertical" >

    <ListView
        android:id="@android:id/list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:divider="#007FFF"
        android:dividerHeight="3dp" >
    </ListView>
</LinearLayout>

<ImageView
    android:id="@+id/whiteline"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:src="@drawable/whiteline" />

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight=".15"
    android:gravity="center"
    android:orientation="vertical" >

    <LinearLayout
        android:id="@+id/okandeditlayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <LinearLayout
            android:id="@+id/editContactlinearlayout"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight=".50"
            android:orientation="horizontal"
            android:paddingRight="2dp" >

            <ImageView
                android:id="@+id/editnumber"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:src="@drawable/newedit" />
        </LinearLayout>

        <LinearLayout
            android:id="@+id/linearLayoutDeleteConatct"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight=".50"
            android:orientation="horizontal"
            android:paddingLeft="2dp" >

            <ImageView
                android:id="@+id/del"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:src="@drawable/newdelete" />
        </LinearLayout>
    </LinearLayout>
</LinearLayout>

Screen shot of issue

Thanks!

like image 393
TheDevMan Avatar asked Feb 08 '26 01:02

TheDevMan


1 Answers

Give a try with this layout:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/LinearLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="2" >

        <com.res.dese.number.ResizableImageView
            android:id="@+id/CImage"
            android:layout_width="120dp"
            android:layout_height="120dp"
            android:padding="5dp"
            android:scaleType="fitXY"
            android:src="@drawable/no_pic" />

        <TextView
            android:id="@+id/PhoneLabel"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:ellipsize="marquee"
            android:freezesText="true"
            android:gravity="center|left"
            android:marqueeRepeatLimit="marquee_forever"
            android:layout_marginLeft="5dp"
            android:scrollHorizontally="true"
            android:singleLine="true"
            android:text="XXX"
            android:textColor="#2CABE2"
            android:textSize="30sp"
            android:textStyle="bold" />
    </LinearLayout>

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:src="@drawable/whiteline" />

    <ListView
        android:id="@+id/listView1"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="12" >
    </ListView>

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:src="@drawable/whiteline" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="2"
        android:padding="5dp" >

        <ImageView
            android:id="@+id/editnumber"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:src="@drawable/newedit" />

        <ImageView
            android:id="@+id/del"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginLeft="2dp"
            android:layout_weight="1"
            android:src="@drawable/newdelete" />
    </LinearLayout>

</LinearLayout>

Instead of LinearLayout you can use RelativeLayout

like image 85
Kaushik Avatar answered Feb 09 '26 16:02

Kaushik



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!