我使用<?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>
在我的某个Android报价应用程序中显示文本。我的文字是从左侧和右侧切割的......我已经测试了填充,边距等但是没有工作。您可以在图像中看到文字切割
我的XML如下所示......
android:ellipsize="marquee"
android:marqueeRepeatLimit="0"
android:singleLine="true"
新图片如下所示
如果有人可以帮我解决问题,请检查并告诉我。 感谢
答案 0 :(得分:0)
尝试删除android:padding="8dp"
的{{1}},
LinearLayout
答案 1 :(得分:0)
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:id="@+id/quoteCard"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/disha"
android:layout_marginBottom="@dimen/activity_horizontal_margin"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_marginTop="4dp"
android:elevation="3dp"
app:cardCornerRadius="6dp">
<ImageView
android:id="@+id/cardBackground"
android:background="@drawable/disha"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY" />
<LinearLayout
android:id="@+id/quoteCardActionView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"
android:gravity="center"
android:orientation="vertical"
android:padding="8dp">
<TextView
android:id="@+id/textDetailQuote"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:lineSpacingExtra="8dp"
android:text="સફળતાની કિંમત હાર્ડ કામ છે, નોકરી પરના સમર્પણને, અને નક્કી કરીએ છીએ કે આપણે જીતી કે ગુમાવું, અમે હાથમાં કાર્ય માટે શ્રેષ્ઠ જાતને લાગુ કર્યો છે."
android:textStyle="bold"
android:typeface="serif" />
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
答案 2 :(得分:0)
试试这段代码:
<?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="@color/gray"
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="@color/orange"
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="સફળતાની કિંમત સખત મહેનત, હાથમાં કામ માટે સમર્પણ, અને નક્કી કરીએ છીએ કે આપણે જીતીએ કે ગુમાવવું છે, અમે સફળતા માટેના મૂલ્ય પર કાર્ય માટે જાતને શ્રેષ્ઠ રીતે લાગુ પાડીએ છીએ, મહેનતનું કામ, હાથે કામ માટે સમર્પણ , અને તે નક્કી કરે છે કે આપણે જીતીએ કે ગુમાવું, અમે હાથમાં કાર્ય માટે શ્રેષ્ઠ જાતને લાગુ કર્યો છે."
android:textSize="20sp"
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>
答案 3 :(得分:0)
我对您的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:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:id="@+id/quoteCard"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="@dimen/activity_horizontal_margin"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_marginTop="4dp"
android:background="@color/colorAccent"
android:elevation="3dp"
app:cardCornerRadius="6dp">
<ImageView
android:id="@+id/cardBackground"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorAccent"
android:scaleType="fitXY" />
<LinearLayout
android:id="@+id/quoteCardActionView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/textDetailQuote"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:lineSpacingExtra="8dp"
android:text="સફળતાની કિંમત હાર્ડ કામ છે, નોકરી પરના સમર્પણને, અને નક્કી કરીએ છીએ કે આપણે જીતી કે ગુમાવું, અમે હાથમાં કાર્ય માટે શ્રેષ્ઠ જાતને લાગુ કર્યો છે."
android:textColor="@android:color/black"
android:textSize="22sp"
android:textStyle="bold"
android:typeface="serif" />
</LinearLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
使用上面使用的XML检查我的设备的屏幕截图。
答案 4 :(得分:0)
更改此文本视图,添加左侧,右侧填充。
<TextView
android:id="@+id/textDetailQuote"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:lineSpacingExtra="8dp"
android:text="સફળતાની કિંમત હાર્ડ કામ છે, નોકરી પરના સમર્પણને, અને નક્કી કરીએ છીએ કે આપણે જીતી કે ગુમાવું, અમે હાથમાં કાર્ય માટે શ્રેષ્ઠ જાતને લાગુ કર્યો છે."
android:textStyle="bold"
android:typeface="serif" />
答案 5 :(得分:0)