1
我正在學習android。我試圖在我的textview中設置marginRight,但是它剪切我的文本並在佈局中顯示空白空間。我的XML如下所示。CardView-TextView marginRight
<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>
這是我的問題的圖像....請檢查並讓我知道。
請檢查,讓我知道我有什麼錯在此。
感謝
嘗試改變'的android:layout_width = 「match_parent」''要在wrap_content'你的TextView。 – Vucko
@Vucko感謝您的建議,但它仍然顯示:( –
我發現這有助於瞭解填充和邊距的概念,我認爲你是困惑他們:http://stackoverflow.com/questions/4619899/difference-between- a-views-padding-and-margin – Jonas