2016-12-04 17 views
5

Not 0: En azından bu kodu deneyin ve sizin için çalışıp çalışmadığını bize bildirin. Çünkü teoride bu çalışmalı, ancakKısıtlama düzeni beta 4 - parçaları çalışmıyor

Not 1: Bu kodda hata yok, alfa-7 üzerinde herhangi bir kısıtlama düzenindeyseniz çalışmaz. Ancak, ben logcat koyarım.

MainActivity.java:

import android.os.Bundle; 
import android.support.v4.app.Fragment; 
import android.support.v4.app.FragmentManager; 
import android.support.v4.app.FragmentTransaction; 
import android.support.v7.app.AppCompatActivity; 

public class MainActivity extends AppCompatActivity { 

    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_main); 
     FragmentManager mFragmentManager = getSupportFragmentManager(); 
     FragmentTransaction mFragmentTransaction = mFragmentManager.beginTransaction(); 
     Fragment fragment = new stupid(); 
     mFragmentTransaction 
       .add(R.id.main_activity, fragment, "stupid") 
       .addToBackStack("stupid") 
       .commit(); 

    } 

} 

activity_main.xml:

<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:id="@+id/main_activity" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@color/colorPrimary" 
    android:clickable="true" 
    android:fitsSystemWindows="true" 
    tools:context=".MainActivity"> 

    <TextView 
     android:text="Hi 1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     tools:layout_editor_absoluteY="13dp" 
     tools:layout_editor_absoluteX="18dp" 
     android:id="@+id/textView" /> 
</android.support.constraint.ConstraintLayout> 

Stupid.java:

import android.os.Bundle; 
import android.support.v4.app.Fragment; 
import android.view.LayoutInflater; 
import android.view.View; 
import android.view.ViewGroup; 


/** 
* A simple {@link Fragment} subclass. 
*/ 
public class stupid extends Fragment { 


    public stupid() { 
     // Required empty public constructor 
    } 


    @Override 
    public View onCreateView(LayoutInflater inflater, ViewGroup container, 
          Bundle savedInstanceState) { 
     // Inflate the layout for this fragment 
     return inflater.inflate(R.layout.fragment_stupid, container, false); 
    } 

} 

fragment_stupid.xml:

<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context="xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx.stupid"> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="@string/hello_blank_fragment" 
     android:id="@+id/textView2" 
     tools:layout_constraintTop_creator="1" 
     tools:layout_constraintLeft_creator="1" 
     app:layout_constraintLeft_toLeftOf="parent" 
     app:layout_constraintTop_toTopOf="parent" 
     android:layout_marginTop="136dp" /> 

</android.support.constraint.ConstraintLayout> 

Giriş:

12-04 10:28:30.965 12609-12609/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx I/art: Late-enabling -Xcheck:jni 
12-04 10:28:31.015 12609-12609/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx I/InstantRun: Instant Run Runtime started. Android package is xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx, real application class is null. 
12-04 10:28:31.299 12609-12609/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx W/art: Failed to find OatDexFile for DexFile /data/data/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx/files/instant-run/dex/slice-slice_1-classes.dex (canonical path /data/data/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx/files/instant-run/dex/slice-slice_1-classes.dex) with checksum 0xe09cbad0 in OatFile /data/data/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx/cache/slice-slice_1-classes.dex 
12-04 10:28:31.512 12609-12609/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx I/LoadedApk: No resource references to update in package common 
12-04 10:28:31.512 12609-12609/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx I/LoadedApk: No resource references to update in package com.brit.swiftdark 
12-04 10:28:31.809 12609-12609/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx W/ResourceType: For resource 0x01030224, entry index(548) is beyond type entryCount(29) 
12-04 10:28:31.809 12609-12609/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx W/ResourceType: For resource 0x01030224, entry index(548) is beyond type entryCount(29) 
12-04 10:28:31.843 12609-12609/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable 
12-04 10:28:31.947 12609-12726/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true 
12-04 10:28:31.956 12609-12609/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx D/Atlas: Validating map... 
12-04 10:28:31.996 12609-12726/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx I/Adreno: QUALCOMM build     : 065751b, 
                      Build Date      : 04/15/15 
                      OpenGL ES Shader Compiler Version: E031.25.03.07 
                      Local Branch      : 
                      Remote Branch     : quic/LA.BF64.1.2.1_rb2.9 
                      Remote Branch     : NONE 
                      Reconstruct Branch    : AU_LINUX_ANDROID_LA.BF64.1.2.1_RB2.05.01.00.081.016 + 065751b + NOTHING 
12-04 10:28:32.003 12609-12726/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx I/OpenGLRenderer: Initialized EGL, version 1.4 
12-04 10:28:32.011 12609-12726/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx D/OpenGLRenderer: Enabling debug mode 0 
12-04 10:28:32.069 12609-12609/xxx.xxxxxxx.xxxxxxxx.xxxxxxxxxxxxx I/Timeline: Timeline: Activity_idle id: [email protected] time:200835125 

Düzenleme 1: Alfa-7 Alpha-7 results

Beta-4 enter image description here

+1

1) Günlük işe yaramıyor, hata yok. 2) İstediğiniz çıktıyı söylemediniz. Bize nasıl göründüğünü ve nasıl göründüğünü/nasıl göründüğünü göster. 3) Başka bir kısıtlama düzeni içinde kısıtlama düzeni olan bir parçayı yerleştirirseniz tam olarak ne bekleyeceksiniz? Kinda zaten bir kısıtlama düzeninin amacını yok ediyor, değil mi? 4) Android Studio'daki düzen tasarımcısını kullanın ve buradaki Mizanpajlarınızı görebildiğinizden emin olun. –

+0

1) Günlüğün zaten bir hatası olmadığını belirttim. Onu oraya koydum çünkü birisi gelecek ve bir sorunla karşı karşıya kaldığım için neden günlüğün olmadığını soracaktır. – MohammedAlSafwan

+0

2) İstenen çıktı kod çalışması yapmak için belirtildi. Anlamı, uygulamayı çalıştırdığınızda düzen oluşturulur. Ancak haklısınız, neyin yanlış olduğunu göstermek ve netleştirmek için resimler eklemeliyim. Benim hatam :). – MohammedAlSafwan

cevap

0

ConstraintLayout 1.0.2 shows nothing Bu "Bu mesaj ve bağlantılı sonrası" hem biliyorum .... bir cevap bu yazı bakın da, cevap benimdir. Ama neredeyse bir yıldır bir cevap arıyordum. Sonunda ConstraintLayout'un eski sürümlerinin, herhangi bir nedenle, etkinliğin üzerine ekleneceğini buldum. ConstraintLayout parçasının yeni sürümleri etkinliğin arkasına yerleştirilir. ya da en azından bana öyle görünüyor. Bu yüzden faaliyetinizi şeffaf hale getireceğim diyorum.