里面TableRox的TextView得到裁剪 - 任何修复? [英] TextView inside TableRox getting cropped - Any fixes?

查看:94
本文介绍了里面TableRox的TextView得到裁剪 - 任何修复?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个问题在我的一个内部的TableRow TextView的越来越第二行的底部冒出。

I'm having this issue where my TextView inside a TableRow is getting the bottom of the second line cropped.

只有这样,才能解决这个问题,我发现是利润率添加到FAV图像左侧,但它只是破坏了设计的其余部分。能向我解释人为什么发生这种情况,如何解决?

The only way to solve this that I found was to add margins to the FAV image on the left but it just ruined the rest of the design. Can someone explain to me why this is happening and how to fix it?

这里的code:
    
    

Here's the code:

    <LinearLayout
        android:id="@+id/item"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/card_bg"
        android:orientation="vertical" >

        <TableLayout
            android:id="@+id/link_title_favicon"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:paddingTop="6dp" >

            <TableRow
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" >

                <com.loopj.android.image.SmartImageView
                    android:id="@+id/expandable_toggle_button"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/favicon_example2" />

                <TextView
                    android:id="@+id/linkTitle0001"
                    android:layout_width="wrap_content"
                    android:layout_height="fill_parent"
                    android:layout_weight="1"
                    android:layout_gravity="center_vertical"
                    android:ellipsize="end"
                    android:fontFamily="sans-serif-condensed"
                    android:maxLines="2"
                    android:paddingLeft="6dp"
                    android:text="@string/link_title_001"
                    android:textColor="#777777"
                    android:textSize="17sp" />
            </TableRow>
        </TableLayout>

        <TextView
            android:id="@+id/linkDesc0001"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/link_title_favicon"
            android:layout_marginTop="4dp"
            android:fontFamily="sans-serif"
            android:maxLines="1"
            android:text="@string/link_desc_001"
            android:textColor="#acacac"
            android:textSize="13sp" />

        <ImageView
            android:id="@+id/labelSource0001"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/linkDesc0001"
            android:layout_marginTop="4dp"
            android:background="@drawable/card_label" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/expandable"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/labelSource0001"
        android:background="@drawable/expmenu_bg"
        android:orientation="horizontal" >

        <!--
            <ImageView
            android:id="@+id/link_preview_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:layout_weight="1"
            android:onClick="onClickPreview"
            android:src="@drawable/link_preview_icon"
            android:src="@drawable/link_preview_icon" />
        -->

        <ImageView
            android:id="@+id/link_forward_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:layout_weight="1"
            android:paddingTop="2dp"
            android:src="@drawable/link_forward_icon" />

        <ImageView
            android:id="@+id/link_share_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:layout_weight="1"
            android:src="@drawable/link_share_icon" />

        <ImageView
            android:id="@+id/link_info_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:layout_weight="1"
            android:src="@drawable/link_info_icon" />

        <ImageView
            android:id="@+id/link_devices_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:layout_weight="1"
            android:paddingTop="2dp"
            android:src="@drawable/link_devices_icon" />

        <ImageView
            android:id="@+id/link_copyurl_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:layout_weight="1"
            android:src="@drawable/link_copyurl_icon" />

        <ImageView
            android:id="@+id/link_delete_btn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:layout_weight="1"
            android:src="@drawable/link_delete_icon" />
    </LinearLayout>

</LinearLayout>

和这里的BG code的情况下,它的需要:

And here's the bg code in case it's needed:

 <?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="rectangle"
            android:dither="true">

            <corners android:radius="2dp"/>

            <solid android:color="#aaaaaa" />

        </shape>
    </item>

    <item android:bottom="2dp">
        <shape android:shape="rectangle"
            android:dither="true">

            <corners android:radius="2dp" />

            <solid android:color="@android:color/white" />

            <padding android:bottom="6dp"
                android:left="6dp"
                android:right="6dp"
                android:top="4dp" />
        </shape>
    </item>
</layer-list>

下面是我的问题的图像:

Here's an image of my issue:

推荐答案

找到了答案。与LinearLayout中替换TableLayout:

Found the answer. Replace the TableLayout with a LinearLayout:

 <LinearLayout
            android:id="@+id/link_title_favicon"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true"
            android:paddingTop="6dp"
            android:orientation="horizontal" >


                <com.loopj.android.image.SmartImageView
                    android:id="@+id/expandable_toggle_button"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/favicon_example2"
                    android:layout_gravity="center_vertical" />

                <TextView
                    android:id="@+id/linkTitle0001"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"
                    android:layout_gravity="center_vertical"
                    android:ellipsize="end"
                    android:fontFamily="sans-serif-condensed"
                    android:maxLines="2"
                    android:paddingLeft="6dp"
                    android:text="@string/link_title_001"
                    android:textColor="#777777"
                    android:textSize="17sp" />

        </LinearLayout>

这篇关于里面TableRox的TextView得到裁剪 - 任何修复?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆