program story

이보기는 제한되지 않습니다.

inputbox 2020. 9. 20. 09:47
반응형

이보기는 제한되지 않습니다.


다음 오류가 발생하고 Android studio 2.2 Preview 3을 사용하고 있습니다. Google을 검색했지만 리소스를 찾을 수 없습니다.

Error: This view is not constrained, it only has design time positions, so it will jump to (0,0) unless you add constraints

여기에 이미지 설명 입력

<TextView
        android:layout_width="384dp"
        android:layout_height="207dp"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:text="@string/calc_default_display"
        android:id="@+id/textView"
        android:background="#ffffff"
        android:layout_margin="0dp"
        android:gravity="bottom|end"
        android:textSize="70sp"
        android:nestedScrollingEnabled="false"
        android:maxLines="2"
        android:maxLength="17"
        tools:layout_editor_absoluteX="0dp"
        tools:layout_editor_absoluteY="0dp" />

이 문제 빠르게 해결 하려면 Android Studio에서 매우 유용한 바로 가기를 사용하세요.

질문 내 위젯> 제약 레이아웃> 제약 추론을 마우스 오른쪽 버튼으로 클릭합니다.

여기에 이미지 설명 입력

그런 다음 https://stackoverflow.com/a/37960888/5556250에 설명 된대로 제약 조건을 조정할 수 있습니다.

최신 정보

Android Studio v3 이상에서는 올바르지 않습니다. 당으로 purpleladydragons의 코멘트 @ :

"Constraint Layout"은 드롭 다운 메뉴에 없습니다. 디자인 미리보기 위의 도구 모음 메뉴에서 마술 지팡이 아이콘을 사용합니다. "Infer Constraints"버튼이 있습니다.


해결책

이것을 클릭하면 해결됩니다


You need to give a value to the constraints manually when using the new layout editor or the missing constraints can be added automatically by clicking the magic wand button in the toolbar menu of the design preview.


you can try this: 1. ensure you have added: compile 'com.android.support:design:25.3.1' (maybe you also should add compile 'com.android.support.constraint:constraint-layout:1.0.2') 2. 여기에 이미지 설명 입력

3.click the Infer Constraints, hope it can help you.


Right Click in then designing part on that component in which you got error and follow these steps:

  • [for ex. if error occur in Plain Text]

[1]

Plain Text Constraint Layout > Infer Constraints:

finally error has gone


Alright so I know this answer is old, but I found out how to do this for version 3.1.4. So for me this error occurs whenever I put in a new item into the hierarchy, so I knew I needed a solution. After tinkering around for a little bit I found how to do it by following these steps:

  1. Right click the object and go to Center.

1 단계

  1. Then select Horizontally.

2 단계

  1. Repeat those steps, except click Vertically instead of Horizontally.

Provided that that method still works, after step two you should see squiggly lines going horizontally across where the item is, and after step three, both horizontally and vertically. After step three, the error will go away!


Right-click on the widget and choose "center" -> "horizontally". Then choose "center"->"vertically".


You just have to right-click on the widget and choose "center" -> "horizontally" and do it again then choose ->"vertically" This worked for me...


From Android Studio v3 and up, Infer Constraint was removed from the dropdown.

Use the magic wand icon in the toolbar menu above the design preview; there is the "Infer Constraints" button. Click on this button, this will automatically add some lines in the text field and the red line will be removed.

여기에 이미지 설명 입력


you can go to the XML file then focus your mouse cursor into your button, text view or whatever you choose for your layout, then press Alt + Enter to fix it, after that the error will be gone.it works for me.


After clicking on the magic wand icon to infer constraints:

1) 프로젝트 창에서 Gradle Scripts> build.gradle (Module : app)로 이동합니다.

2) 종속성으로 스크롤하십시오.

3) 구현 'com.android.support:appcompat-v7:28.0.0-beta03'을 찾습니다.

4)이 줄을 'com.android.support:appcompat-v7:28.0.0-alpha1'구현으로 변경하십시오.

5) 창 상단에 배너가 나타나면 오른쪽 모서리에있는 지금 동기화를 클릭합니다.

이것은 Android Studio v3.1에서 작동하며 build.gradle 파일 편집 이미지를 클릭합니다.

참고 URL : https://stackoverflow.com/questions/37817537/this-view-is-not-constrained

반응형