我正在学习android。我试图在我的textview中设置marginRight,但它切割我的文本并在布局中显示空白空间。我的XML如下所示。
<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: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:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
android:padding="8dp"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<de.hdodenhof.circleimageview.CircleImageView
android:layout_marginTop="20dp"
android:layout_gravity="center_horizontal"
android:id="@+id/authorImage"
android:layout_width="128dp"
android:layout_height="128dp"
app:civ_border_width="2dp"
app:civ_border_color="#99333333"/>
<TextView
android:layout_weight="1"
android:gravity="center"
android:layout_marginTop="6dp"
android:layout_marginRight="20dp"
android:layout_marginLeft="20dp"
android:layout_marginBottom="6dp"
android:lineSpacingExtra="15dp"
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.Read more at: "
android:textSize="18sp"
android:textStyle="bold"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:layout_marginBottom="10dp"
android:layout_marginRight="8dp"
android:id="@+id/textAuthorSign"
android:layout_gravity="right"
android:text="- ABJ Abdul Kalam"
android:textStyle="bold"
android:textSize="16sp"
android:visibility="invisible"
android:typeface="serif"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</android.support.v7.widget.CardView>
这是我的问题的形象....请检查并告诉我。
请检查并告诉我这里的错误。
由于
答案 0 :(得分:1)
而不是maringLeft和marginRight在textView中使用paddingLeft和paddingRight
<TextView
android:gravity="center"
android:layout_marginTop="6dp"
android:paddingRight="16dp"
android:paddingLeft="16dp"
android:layout_marginBottom="6dp"
android:lineSpacingExtra="15dp"
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.Read more at: "
android:textSize="18sp"
android:textStyle="bold"
android:layout_width="match_parent"
android:layout_height="wrap_content" />