내 앱의 경우 부모의 오른쪽 끝에 정렬 된 스피너가 있어야합니다.Android - Spinner가 부모 끝까지 올바르게 정렬되지 않았습니다.
<Spinner
android:id="@+id/createsub_cycle_spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/imageView3"
android:layout_alignParentEnd="true"
android:layout_below="@+id/imageView2"
android:layout_marginEnd="10dp"
android:textColorHint="@android:color/white"
android:textSize="18sp" />
볼, alignParentEnd
가 true
으로 설정됩니다
이 내 스피너 XML이다. 나는 응용 프로그램을 실행할 때
는 아직도 resut는 다음과 같습니다 :
"주간"의 오른쪽에 차이가 없을 것이다. 파란색 레이아웃의 맨 끝에 맞추어야합니다.
어떻게 수정합니까?
EDIT :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<android.support.v7.widget.CardView
android:id="@+id/createsub_card"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp">
<ImageView
android:id="@+id/createsub_image"
android:layout_width="50dp"
android:layout_height="50dp"
android:scaleType="fitCenter"
android:layout_gravity="center_horizontal"
android:layout_margin="20dp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="80dp">
<TextView
android:id="@+id/createsub_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:textColor="@android:color/white"
android:textSize="18sp" />
<EditText
android:id="@+id/createsub_user_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_marginEnd="10dp"
android:maxLines="1"
android:onClick="onTitleClicked"
android:textAlignment="center"
android:textColor="@android:color/white"
android:textSize="18sp" />
<ImageView
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_below="@id/createsub_title"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:background="@android:color/white" />
<TextView
android:id="@+id/createsub_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/createsub_title"
android:layout_margin="10dp"
android:textColor="@android:color/white"
android:textSize="18sp" />
<Spinner
android:id="@+id/createsub_currency_spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/imageView2"
android:dropDownWidth="40dp"
android:layout_alignParentEnd="true"
android:layout_below="@id/createsub_user_title"
android:layout_marginEnd="10dp" />
<EditText
android:id="@+id/createsub_user_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/imageView2"
android:layout_alignTop="@id/createsub_currency_spinner"
android:layout_toStartOf="@id/createsub_currency_spinner"
android:inputType="numberDecimal"
android:maxLines="1"
android:textColor="@android:color/white"
android:textSize="18sp"
android:hint="0.00"
android:textColorHint="@android:color/white"/>
<ImageView
android:id="@+id/imageView2"
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_below="@id/createsub_price"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:background="@android:color/white" />
<TextView
android:id="@+id/createsub_cycle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/createsub_price"
android:layout_margin="10dp"
android:text="@string/cycle"
android:textColor="@android:color/white"
android:textSize="18sp" />
<Spinner
android:id="@+id/createsub_cycle_spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/imageView3"
android:layout_alignParentEnd="true"
android:layout_below="@+id/imageView2"
android:layout_marginEnd="10dp"
android:textColorHint="@android:color/white"
android:textSize="18sp" />
<ImageView
android:id="@+id/imageView3"
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_below="@id/createsub_cycle"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:background="@android:color/white" />
<TextView
android:id="@+id/createsub_firstbill"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/createsub_cycle"
android:layout_margin="10dp"
android:text="@string/first_bill"
android:textColor="@android:color/white"
android:textSize="18sp" />
<!--TODO: when clicked has to show datepickerdialog-->
<EditText
android:id="@+id/createsub_user_firstbill"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/imageView4"
android:layout_alignEnd="@+id/imageView4"
android:layout_below="@+id/imageView3"
android:inputType="date"
android:maxLines="1"
android:textColor="@android:color/white"
android:textSize="18sp" />
<ImageView
android:id="@+id/imageView4"
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_below="@id/createsub_firstbill"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:background="@android:color/white" />
<TextView
android:id="@+id/createsub_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/createsub_firstbill"
android:layout_margin="10dp"
android:text="@string/duration"
android:textColor="@android:color/white"
android:textSize="18sp" />
<Spinner
android:id="@+id/createsub_duration_selector"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/imageView5"
android:layout_alignParentEnd="true"
android:layout_below="@+id/imageView4"
android:layout_marginEnd="10dp"
android:textColor="@android:color/white"
android:textSize="18sp" />
<ImageView
android:id="@+id/imageView5"
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_below="@id/createsub_duration"
android:layout_marginEnd="10dp"
android:layout_marginStart="10dp"
android:background="@android:color/white" />
<TextView
android:id="@+id/createsub_remindme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/createsub_duration"
android:layout_margin="10dp"
android:text="@string/remind_me"
android:textColor="@android:color/white"
android:textSize="18sp" />
<Spinner
android:id="@+id/createsub_reminder_selector"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/createsub_user_firstbill"
android:layout_below="@+id/imageView5"
android:textColorHint="@android:color/white"
android:textSize="18sp" />
</RelativeLayout>
</android.support.v7.widget.CardView>
도움을 주셔서 감사합니다. 부분적으로 그 것이 었습니다. 다른 것은 스피너가 배열을 기반으로하고 그 배열에 "weekly"보다 긴 문자열이 있기 때문에 그는 그 공간을 유지하고있었습니다. 필자는 텍스트를 끝에 정렬하여 간격을 제거하는'spinner_item.xml'에'android : textAlignment = "viewEnd"'를 추가하여이를 해결했습니다. – Daniele