Soru & Cevap

Konpenetlerin kayması ...

24.04.2020 - 10:22

KOTLİN dilinde yazdığım projemde konpenentleri doğru bir şekilde düzenlememe rağmen emülatörde istediğim gibi görünsede projemi apk ya çevirip telefonda actığında bazı konpenetlerin yerlerinin kaydığını gördüm bu daha önceden böyle değildi bir şekilde güncellerken bir yerde birşeyi sildim yada değiştirdim sanırım bu şekilde oldu

aşağıda emülatörde görünümü mevcut

https://hizliresim.com/cL6GvW

buda apk nın telefonda acıldığında aldığı hal 

https://hizliresim.com/KwMnf2

 

kodlar

 

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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/chatloglayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clickable="true"
    android:focusable="true"
    android:focusableInTouchMode="true"
    tools:context=".messages.ChatLogActivity"
    android:background="@color/Messagebackground">


    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/messageInputContainer"
        android:layout_width="351dp"
        android:layout_height="45dp"
        android:layout_margin="6dp"
        android:layout_marginStart="8dp"
        android:layout_marginLeft="8dp"
        android:layout_marginBottom="4dp"
        android:background="@drawable/rounded_edittext_register_login"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toLeftOf="@+id/send_button_chat_log"
        app:layout_constraintStart_toStartOf="parent"
        tools:context="com.example.chattutorial.ChannelActivity">

        <ImageButton
            android:id="@+id/addEmoticon"
            android:layout_width="21dp"
            android:layout_height="match_parent"
            android:layout_marginStart="16dp"
            android:layout_marginLeft="16dp"
            android:background="@null"
            android:contentDescription="TODO"
            android:src="@drawable/ic_sentiment_very_satisfied_black_24dp"
            android:tint="@color/message_input_button_inactive"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            tools:layout_editor_absoluteY="0dp" />

        <EditText
            android:id="@+id/edittext_chat_log"
            android:layout_width="228dp"
            android:layout_height="48dp"
            android:layout_marginLeft="12dp"
            android:background="@android:color/transparent"
            android:hint="@string/enter_message"
            app:layout_constraintLeft_toRightOf="@+id/addEmoticon"
            app:layout_constraintRight_toLeftOf="@+id/addAttachment"
            tools:ignore="MissingConstraints"
            tools:layout_editor_absoluteY="0dp" />

        <ImageButton
            android:id="@+id/addAttachment"
            android:layout_width="22dp"
            android:layout_height="match_parent"
            android:layout_marginEnd="10dp"
            android:layout_marginRight="10dp"
            android:background="@null"
            android:src="@drawable/ic_attach_file_black_24dp"
            android:tint="@color/message_input_button_inactive"
            app:layout_constraintRight_toLeftOf="@+id/takePicture" />

        <ImageButton
            android:id="@+id/takePicture"
            android:layout_width="22dp"
            android:layout_height="match_parent"
            android:layout_marginEnd="20dp"
            android:layout_marginRight="20dp"
            android:background="@null"
            android:src="@drawable/ic_camera_alt_black_24dp"
            android:tint="@color/message_input_button_inactive"
            app:layout_constraintRight_toRightOf="parent" />

    </androidx.constraintlayout.widget.ConstraintLayout>

    <com.google.android.material.floatingactionbutton.FloatingActionButton
        android:id="@+id/send_button_chat_log"
        android:layout_width="44dp"
        android:layout_height="46dp"
        android:layout_margin="6dp"
        android:layout_marginBottom="4dp"
        android:src="@drawable/ic_send_black_24dp"
        app:backgroundTint="@color/colorAccent"
        app:fabCustomSize="48dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="1.0"
        app:layout_constraintStart_toEndOf="@+id/messageInputContainer"
        app:tint="@color/colorWhite" />

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/recyclerview_chat_log"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_marginBottom="3dp"
        app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
        app:layout_constraintBottom_toTopOf="@+id/messageInputContainer"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />


</androidx.constraintlayout.widget.ConstraintLayout>

 

104 Görüntülenme

2 Cevap

Sitedeki sorulara cevap verebilmek için giriş yapın ya da üye olun.

Profile picture for user eflasoft
eflasoft
26.04.2020 - 10:43

Tabii ki match_parent yaptıktan sonra bunları sileceksiniz.

app:layout_constraintLeft_toLeftOf="parent"

app:layout_constraintRight_toLeftOf="@+id/send_button_chat_log"

app:layout_constraintStart_toStartOf="parent"

 

Sadece 

app:layout_constraintBottom_toBottomOf="parent" kalacak

 

Marginlerde de hatalar var, çok fazla margin kullanmışsınız. marginLeft kullanıyorsanız marginStart kullanmamanız gerekiyor. Eğer marginLeft kullanırsanız her dilde soldan margin veririr. marginStart kullanırsanız Arapça gibi sağdan sola doğru yazılan dillerde sağdan margin verir.

Altta biraz düzenledim. 

app:layout_constraintRight_toLeftOf gibi tanımlamalar pek sağlıklı olmuyor. O yüzden Linearlayout kullanmanızı tavsiye ederim.

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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/chatloglayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clickable="true"
    android:focusable="true"
    android:focusableInTouchMode="true"
    tools:context=".messages.ChatLogActivity"
    android:background="@color/Messagebackground">


    <androidx.constraintlayout.widget.ConstraintLayout
        android:id="@+id/messageInputContainer"
        android:layout_width="match_parent"
        android:layout_height="45dp"
        android:layout_marginLeft="8dp"
        android:layout_marginBottom="4dp"
        android:layout_marginRight="50dp"
        android:background="@drawable/rounded_edittext_register_login"
        app:layout_constraintBottom_toBottomOf="parent"
        tools:context="com.example.chattutorial.ChannelActivity">

        <ImageButton
            android:id="@+id/addEmoticon"
            android:layout_width="21dp"
            android:layout_height="match_parent"
            android:layout_marginLeft="16dp"
            android:background="@null"
            android:contentDescription="TODO"
            android:src="@drawable/ic_sentiment_very_satisfied_black_24dp"
            android:tint="@color/message_input_button_inactive"
            app:layout_constraintLeft_toLeftOf="parent"
            tools:layout_editor_absoluteY="0dp" />

        <EditText
            android:id="@+id/edittext_chat_log"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginLeft="37dp"
            android:layout_marginRight="74dp"
            android:background="@android:color/transparent"
            android:hint="@string/enter_message"
            tools:ignore="MissingConstraints"
            tools:layout_editor_absoluteY="0dp" />

        <ImageButton
            android:id="@+id/addAttachment"
            android:layout_width="22dp"
            android:layout_height="match_parent"
            android:layout_marginRight="52dp"
            android:background="@null"
            android:src="@drawable/ic_attach_file_black_24dp"
            android:tint="@color/message_input_button_inactive"
            app:layout_constraintRight_toRightOf="parent" />

        <ImageButton
            android:id="@+id/takePicture"
            android:layout_width="22dp"
            android:layout_height="match_parent"
            android:layout_marginRight="20dp"
            android:background="@null"
            android:src="@drawable/ic_camera_alt_black_24dp"
            android:tint="@color/message_input_button_inactive"
            app:layout_constraintRight_toRightOf="parent" />

    </androidx.constraintlayout.widget.ConstraintLayout>

    <com.google.android.material.floatingactionbutton.FloatingActionButton
        android:id="@+id/send_button_chat_log"
        android:layout_width="44dp"
        android:layout_height="46dp"
        android:layout_margin="6dp"
        android:src="@drawable/ic_send_black_24dp"
        app:backgroundTint="@color/colorAccent"
        app:fabCustomSize="48dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:tint="@color/colorWhite" />

    <androidx.recyclerview.widget.RecyclerView
        android:id="@+id/recyclerview_chat_log"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_marginBottom="3dp"
        app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
        app:layout_constraintBottom_toTopOf="@+id/messageInputContainer"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent" 
        app:layout_constraintTop_toTopOf="parent" />


</androidx.constraintlayout.widget.ConstraintLayout>

 

 

 

Turgay KAZDAL
27.04.2020 - 11:40
evet sorunun kaynağı gerçekten de oradaymış şimdi düzeldi en başta böyleyleydi zaten anlamadan bir şekilde bozmuştum orayı ben teşekküer ederim herşey için...
Ömer yazılımcı
28.04.2020 - 02:56
Rica ederim.
Profile picture for user eflasoft
eflasoft
24.04.2020 - 11:05

Merhabalar,

"messageInputContainer"a sabit width değeri verdiğiniz için farklı ekran boyutlarında hatalı görünür. width değerini match_parent yapıp, sağdan "send_button_chat_log" width değeri kadarı margin veriniz.

Başka bir tavsiye olarak;

"chatloglayout"ı horizontalLinearLayout olarak değiştirin, "messageInputContainer"ı width=0, weight=1 yapın.

 

Turgay KAZDAL
26.04.2020 - 04:28
söylediğinizi yaptım bu kezde telefonda aldığı hali aldı emülatörde de başka birşeyin etkilediğini düşünüyorum gözden kaçan bir ayrıntı var sanırım birde acaba problem bunlardanmı kaynaklanıyor diye düşünüyorum pp:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toLeftOf="@+id/send_button_chat_log" app:layout_constraintStart_toStartOf="parent"