2016-09-20 9 views
0

Android Studio 2.2으로 업데이트 했으므로 간단한 활동을 생성하기 위해 ConstraintLayout을 새로 시도했습니다. 놀랍게도 alpha 8 (현재 최신 버전)은 실제로 버그가있어서 청사진 단계에서 여러 번 재설정됩니다.ConstraintLayout의 청사진이 최종 디자인과 일치하지 않습니다.

Design and Blueprint

종속성 :

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    //testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:24.2.1' 
    compile 'com.android.support:design:24.2.1' 
    compile 'com.google.android.gms:play-services-appindexing:9.4.0' 
    compile 'org.apache.openejb:openejb-telnet:3.1.4' 
    compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha8' 
} 

내가 선택 취소 또는 확인 기억하고

주요 문제는 청사진을 통해 추가 한 모든 항목이 디자인 탭에 제약되지 않는 것입니다 새로운 빈 활동을 만들 때 몇 가지 체크 표시. 그것과 관련이 있습니까?

활동 등급은 Activity입니다.

새로운 레이아웃 생성자의 버그를 제거하는 데 도움을주십시오.

XML :

<?xml version="1.0" encoding="utf-8"?> 
<android.support.constraint.ConstraintLayout 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/activity_telnet" 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    tools:context="xx.xxx.xxxx.TelnetActivity"> 

    <TextView 
     android:text="IP:" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@+id/tv_IP" 
     app:layout_constraintTop_toTopOf="parent" 
     app:layout_constraintLeft_toLeftOf="parent"/> 
    <EditText 
     android:layout_width="180dp" 
     android:layout_height="16dp" 
     android:inputType="text|textPersonName" 
     android:ems="10" 
     android:id="@+id/et_IP" 
     android:layout_marginStart="80dp" 
     app:layout_constraintTop_toTopOf="parent" 
     app:layout_constraintLeft_toRightOf="@+id/tv_IP" android:layout_marginLeft="80dp" 
    /> 
    <TextView 
     android:text="Port:" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@+id/tv_port" 
     app:layout_constraintLeft_toLeftOf="@+id/tv_IP" 
     android:layout_marginTop="16dp" app:layout_constraintTop_toBottomOf="@+id/tv_IP"/> 
    <EditText 
     android:layout_width="180dp" 
     android:layout_height="16dp" 
     android:inputType="number" 
     android:ems="10" 
     android:id="@+id/et_port" 
     app:layout_constraintBottom_toBottomOf="@+id/tv_port" 
     app:layout_constraintLeft_toLeftOf="@+id/et_IP" 
    /> 
    <Button 
     android:text="Connect" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@+id/btn_connect" 
     app:layout_constraintRight_toRightOf="parent" 
     android:layout_marginTop="16dp" app:layout_constraintTop_toBottomOf="@+id/et_port" 
     app:layout_constraintLeft_toLeftOf="parent" 
     tools:layout_constraintRight_creator="1" tools:layout_constraintLeft_creator="1" 
     android:onClick="connect (TelnetActivity)"/> 
    <TextView 
     android:text="Status:" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@+id/textView3" 
     android:layout_marginTop="16dp" app:layout_constraintTop_toBottomOf="@+id/btn_connect" 
     app:layout_constraintLeft_toLeftOf="parent"/> 
    <TextView 
     android:text="Disconnected" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@+id/tv_status" 
     app:layout_constraintTop_toTopOf="@+id/textView3" 
     app:layout_constraintLeft_toLeftOf="@+id/et_port"/> 
    <TextView 
     android:text="Send msg:" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@+id/textView4" 
     android:layout_marginTop="16dp" app:layout_constraintTop_toBottomOf="@+id/textView3" 
     app:layout_constraintLeft_toLeftOf="@+id/textView3"/> 
    <EditText 
     android:layout_height="16dp" 
     android:ems="10" 
     android:id="@+id/et_sendMsg" 
     android:layout_width="180dp" android:inputType="text" 
     app:layout_constraintBottom_toBottomOf="@+id/textView4" 
     app:layout_constraintRight_toRightOf="@+id/et_port"/> 
    <TextView 
     android:text="Response:" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@+id/textView5" 
     android:layout_marginTop="16dp" app:layout_constraintTop_toBottomOf="@+id/textView4" 
     app:layout_constraintLeft_toLeftOf="parent"/> 
    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@+id/tv_response" 
     app:layout_constraintBottom_toBottomOf="@+id/textView5" 
     app:layout_constraintLeft_toLeftOf="@+id/tv_status" 
     app:layout_constraintTop_toTopOf="@+id/textView5"/> 
    <Button 
     android:text="OK" 
     android:layout_width="88dp" 
     android:layout_height="48dp" 
     android:id="@+id/btn_sendMsg" 
     app:layout_constraintBottom_toBottomOf="@+id/et_sendMsg" 
     app:layout_constraintTop_toTopOf="@+id/et_sendMsg" 
     android:layout_marginBottom="16dp" 
     android:layout_marginStart="24dp" 
     app:layout_constraintLeft_toRightOf="@+id/et_port" android:layout_marginLeft="24dp" 
     app:layout_constraintVertical_bias="0.44" android:onClick="sendMsg (TelnetActivity)"/> 
</android.support.constraint.ConstraintLayout> 

PS : 다시 시작 안드로이드 스튜디오는 내가 그들 중 하나를 이동할 때까지 오른쪽 장소에있는 모든 요소를 ​​얻기에 도움을 주었다. 그 후에 모든 것이 다시 붕괴됩니다.

+0

코드를 게시하여 디버그 할 수도 있습니다. – apmartin1991

답변

0

알파 7에서 알파 8로 업데이트 한 경우 (Android Studio 2.2를 다운로드 한 경우 일 가능성이 있음) 프로젝트 재구성 및/또는 Studio에서 파일 -> 캐시 무효화가 필요합니다. 충분히되었습니다. 그게 너에게 효과가 있는지 말해봐.

또한; 어떤 환경에서 뛰고 있습니까? (Windows, Mac, Linux, JVM ...)

+0

alpha 7에서 업데이트하지 않았고, alpha 8이 처음 출시되었습니다. Mac OS X 10.11.6을 사용하고 있습니다. Studio에서 파일 -> 무효화 캐시는 지금까지 트릭을했습니다 :) 추신 : 그냥 ConstraintLayout에 대한 프레젠테이션을 보았습니다! 그것은 당신이 대답 한 sooo 마약입니다! – FlyRanger

+0

도움이 되니 기쁩니다! –