【发布时间】:2017-05-31 09:48:12
【问题描述】:
我正在使用cardview 在我的一个 android 报价应用程序中显示文本。我的文本是从左侧和右侧剪切的...我已经测试了填充、边距等,但没有工作。可以看到图片中的文字切割
我的 XML 如下所示...
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.CardView
android:id="@+id/quoteCard"
android:layout_marginTop="4dp"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:background="@drawable/newbackg"
android:layout_marginBottom="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_width="match_parent"
android:elevation="3dp"
app:cardCornerRadius="6dp"
android:layout_height="match_parent">
<ImageView
android:id="@+id/cardBackground"
android:scaleType="fitXY"
android:background="@drawable/newbackg"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
android:id="@+id/quoteCardActionView"
android:background="?attr/selectableItemBackground"
android:padding="8dp"
android:gravity="center"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textDetailQuote"
android:text="The price of success is hard work, dedication to the job at hand, and the determination that whether we win or lose, we have applied the best of ourselves to the task at hand."
android:textSize="@dimen/newMainText"
android:lineSpacingExtra="8dp"
android:textStyle="bold"
android:gravity="center"
android:textColor="@color/black"
android:typeface="serif"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
新图像如下所示
请检查并让我知道是否有人可以帮助我解决问题。 谢谢
【问题讨论】:
-
设置左右边距为
TextView -
我认为这是因为您在
card view和image view中使用的背景。你可以发布你的背景图片吗?尝试从card view中删除背景并检查一次。 -
@jaydroider 没有任何变化......
-
请粘贴您的图片@drawable/newbackg @Manisha
-
但实际上不错的报价!并检查我的答案。
标签: java android android-layout android-cardview