android : layout_alignParentBottom이 런타임에서 작동하지 않음

판 반 린

각 항목에 대해 android:layout_alignParentBottom아래쪽 화살표를 사용하고 ImageView있습니다 . 하지만 모드 에서만 완벽하게 작동하고 앱을 실행할 때 작동하지 않습니다. 왜 이런 일이 일어 났는지 모르겠습니다. 스크린 샷에서 내 문제에 대해 자세히 설명했습니다.RelativeLayoutRecyleView
Preview

미리보기 에서 런타임에
여기에 이미지 설명 입력

여기에 이미지 설명 입력

 <android.support.v7.widget.CardView
        android:id="@+id/cv"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <LinearLayout
                android:id="@+id/item_layoutStart"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="#E8F5E9"
                android:orientation="vertical">

                <ImageView
                    android:layout_width="25dp"
                    android:layout_height="25dp"
                    android:layout_gravity="center_vertical|right"
                    android:clickable="true"
                    android:scaleType="fitCenter"
                    android:src="@mipmap/ic_launcher" />

                <ImageView
                    android:layout_width="25dp"
                    android:layout_height="25dp"
                    android:layout_gravity="center_vertical|right"
                    android:clickable="true"
                    android:scaleType="fitCenter"
                    android:src="@mipmap/ic_launcher" />
                <ImageView
                    android:layout_width="25dp"
                    android:layout_height="25dp"
                    android:layout_gravity="center_vertical|right"
                    android:clickable="true"
                    android:scaleType="fitCenter"
                    android:src="@mipmap/ic_launcher" />
                <TextView
                    android:id="@+id/item_tvRepeatTime"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:text="10" />
            </LinearLayout>

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="#ff0"
                android:layout_alignTop="@id/item_layoutStart"
                android:layout_alignBottom="@id/item_layoutStart"
                android:orientation="vertical"
                android:layout_toRightOf="@id/item_layoutStart">
                <TextView
                    android:id="@+id/item_tvTitle"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="aa aa aaaaaa aa aa aaaaaa aa aa aaaaaa " />
                <TextView
                    android:id="@+id/item_tvResult"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_below="@id/item_tvTitle"
                    android:text="aa aa aaaaaa aa aa aaaaaa aa aa aaaaaa" />
                <ImageView android:id="@+id/item_ivExpand"
                    android:layout_width="30dp"
                    android:layout_height="30dp"
                    android:layout_alignParentRight="true"
                    android:layout_alignParentBottom="true"
                    android:padding="3dp"
                    android:src="@drawable/selector_arrow_down"/>
            </RelativeLayout>
        </RelativeLayout>
    </android.support.v7.widget.CardView>

업데이트RelativeLayout 특정 값 으로 내 키를 고정 하면 android:layout_alignParentBottom 작업

 <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="200dp"
 > 

하지만 제 경우에는 RelativeLayout높이가LinearLayout

<RelativeLayout
                android:layout_alignTop="@id/item_layoutStart"
                android:layout_alignBottom="@id/item_layoutStart"
               >

android:layout_alignParentBottom 작동하지

어떤 도움이라도 대단히 감사하겠습니다.

마이크 M.

Though this solution apparently messes with the way the layout looks in the editor, it solves the problem of the runtime layout.

First, change the outer RelativeLayout to a LinearLayout. Then, on the inner RelativeLayout, remove the layout_alignTop and layout_alignBottom attributes altogether, and set the layout_height to match_parent.

As you can see in the posted screenshots, that ImageView was being laid out as though its parent RelativeLayout's height was wrapping its child Views, as per its layout_height setting. However, after the RelativeLayout's child Views were laid out, its layout_alignTop and layout_alignBottom attributes were being applied, and it was resized to match the LinearLayout's height, but that ImageView just stayed where it was.

를 사용하여 LinearLayout외부에 대한 ViewGroup, 그리고 내부 설정 RelativeLayout'으로의 높이 match_parent의이 RelativeLayout그것을 밖으로 자식 배치하기 전에 일정한 높이를 적용했다 View들과 ImageViewlayout_alignParentRightlayout_alignParentBottom속성은 정확한 지점에 착륙했다.

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

android : layout_alignParentBottom = "true"가 하단에 AdMob을 추가하는 데 작동하지 않음

분류에서Dev

런타임시 DOM 렌더링이 Dojox에서 작동하지 않음

분류에서Dev

런타임에 WPF 창 여백이 작동하지 않음

분류에서Dev

Android Eclipse에서 타이머가 작동하지 않음

분류에서Dev

Android 앱이 작동하는 데 시간이 걸리는 런타임에서 작동하지 않습니다.이 문제를 해결하는 방법

분류에서Dev

Java 런타임이 Mac에서 STDOUT을 캡처하지 않음

분류에서Dev

UserDefine 런타임 속성이 Xcode8.0에서 작동하지 않습니다.

분류에서Dev

DotVVM 런타임의 Panel 구성 요소에서 CssStyle 속성 변경이 작동하지 않음

분류에서Dev

런타임에 Chromium 용 API 키 제공이 작동하지 않음

분류에서Dev

wpf 컨트롤 템플릿이 런타임에 작동하지 않음

분류에서Dev

티타늄 Android : calendarViewShown이 Android 5.x 이상에서 작동하지 않음

분류에서Dev

Android에서 Facebook Post Like 작업이 작동하지 않음

분류에서Dev

Android에서 Facebook Post Like 작업이 작동하지 않음

분류에서Dev

Phonegap Android 앱이 Android KitKat에서 작동하지 않음

분류에서Dev

SwipeRefreshLayout이 Android 버전 22 이하에서 작동하지 않음

분류에서Dev

Android 경고 대화 스타일이 삼성 6.0.1에서 작동하지 않음

분류에서Dev

Android에서 통화 녹음이 작동하지 않는 이유

분류에서Dev

Cordova Ionic 앱이 Android 9 및 10에서 작동하지 않음

분류에서Dev

Android 스튜디오에서 Gradle이 작동하지 않음 [flutter]

분류에서Dev

Eclipse에서 Android 앱 디버깅이 작동하지 않음

분류에서Dev

CSS 높이 %가 Android 앱 화면에서 작동하지 않음

분류에서Dev

DrawerLayout이 Android 4.4 및 SurfaceView에서 작동하지 않음

분류에서Dev

Android Studio에서 Gradle 종속성이 작동하지 않음

분류에서Dev

스피너 선택이 Android에서 작동하지 않음

분류에서Dev

Android 4.4.2 또는 iPhone에서 JS If 문이 작동하지 않음

분류에서Dev

내 앱에서 Android TextView 및 버튼이 작동하지 않음

분류에서Dev

Android Chrome에서만 스크롤이 작동하지 않음

분류에서Dev

iOS에서 Android로 푸시 알림이 작동하지 않음

분류에서Dev

Android 용 Chrome에서 CSS "display : block"이 작동하지 않음

Related 관련 기사

  1. 1

    android : layout_alignParentBottom = "true"가 하단에 AdMob을 추가하는 데 작동하지 않음

  2. 2

    런타임시 DOM 렌더링이 Dojox에서 작동하지 않음

  3. 3

    런타임에 WPF 창 여백이 작동하지 않음

  4. 4

    Android Eclipse에서 타이머가 작동하지 않음

  5. 5

    Android 앱이 작동하는 데 시간이 걸리는 런타임에서 작동하지 않습니다.이 문제를 해결하는 방법

  6. 6

    Java 런타임이 Mac에서 STDOUT을 캡처하지 않음

  7. 7

    UserDefine 런타임 속성이 Xcode8.0에서 작동하지 않습니다.

  8. 8

    DotVVM 런타임의 Panel 구성 요소에서 CssStyle 속성 변경이 작동하지 않음

  9. 9

    런타임에 Chromium 용 API 키 제공이 작동하지 않음

  10. 10

    wpf 컨트롤 템플릿이 런타임에 작동하지 않음

  11. 11

    티타늄 Android : calendarViewShown이 Android 5.x 이상에서 작동하지 않음

  12. 12

    Android에서 Facebook Post Like 작업이 작동하지 않음

  13. 13

    Android에서 Facebook Post Like 작업이 작동하지 않음

  14. 14

    Phonegap Android 앱이 Android KitKat에서 작동하지 않음

  15. 15

    SwipeRefreshLayout이 Android 버전 22 이하에서 작동하지 않음

  16. 16

    Android 경고 대화 스타일이 삼성 6.0.1에서 작동하지 않음

  17. 17

    Android에서 통화 녹음이 작동하지 않는 이유

  18. 18

    Cordova Ionic 앱이 Android 9 및 10에서 작동하지 않음

  19. 19

    Android 스튜디오에서 Gradle이 작동하지 않음 [flutter]

  20. 20

    Eclipse에서 Android 앱 디버깅이 작동하지 않음

  21. 21

    CSS 높이 %가 Android 앱 화면에서 작동하지 않음

  22. 22

    DrawerLayout이 Android 4.4 및 SurfaceView에서 작동하지 않음

  23. 23

    Android Studio에서 Gradle 종속성이 작동하지 않음

  24. 24

    스피너 선택이 Android에서 작동하지 않음

  25. 25

    Android 4.4.2 또는 iPhone에서 JS If 문이 작동하지 않음

  26. 26

    내 앱에서 Android TextView 및 버튼이 작동하지 않음

  27. 27

    Android Chrome에서만 스크롤이 작동하지 않음

  28. 28

    iOS에서 Android로 푸시 알림이 작동하지 않음

  29. 29

    Android 용 Chrome에서 CSS "display : block"이 작동하지 않음

뜨겁다태그

보관