我在佈局中遇到問題。 CheckedTextView中的複選框始終位於textview的右側。我如何將它與列表的右邊緣對齊?將複選框設置在CheckedTextView的最右端
謝謝你未來的答案。
這裏是我的佈局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:src="@drawable/ic_launcher"/>
<CheckedTextView
android:id="@+id/checkedTextView"
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeightSmall"
android:checkMark="?android:attr/listChoiceIndicatorMultiple"
android:gravity="right|center_vertical"
android:paddingLeft="?android:attr/listPreferredItemPaddingLeft"
android:textAppearance="?android:attr/textAppearanceListItemSmall" />
</LinearLayout>
我只是將您的佈局完全粘貼到我的代碼中,並且它看起來非常完美,並且複選框始終位於右側。也許問題是你的目標SDK?礦井設置爲23. – Gi0rgi0s
在圖形佈局看起來很好。但是當插入值時,它們正好在名稱旁邊 – JJCADIZ
我在模擬器中試過了,它看起來不錯。這就是爲什麼我想知道在你的ListView中'layout_width'設置爲'match_parent'的原因。你正在使用ListView,對嗎? – Gi0rgi0s