Is this a bug at Android Studio?

≯℡__Kan透↙ 提交于 2019-12-11 06:26:55

问题


I make UI of many buttons to input text by constraint layout. For example, the following image.

But,I feel strange that android studio become very slow as I put more UIs and adaptive hook allows I set, sometimes disappear(ex.some buttons' allow disapper head row above image).It should use very large memory and I guess free memory to calculate position and re-render UI. Can I avoid this situation? or Alternative way to make same UI using another layout. I'm very nervous for this problem because I can't understand the best way to make grid flexible-scaling UI.Any tips will help me.


回答1:


I could solve the problem using grid layout enclosing the buttons nested constraint view and it seem best way that relative positioning UI.

<?xml version="1.0" encoding="utf-8"?>
<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">

<EditText
        android:layout_width="456dp"
        android:layout_height="64dp"
        android:inputType="textPersonName"
        android:text="Name"
        android:ems="10"
        android:id="@+id/editText"
        android:layout_marginTop="16dp"
        app:layout_constraintTop_toTopOf="parent"
        android:layout_marginStart="16dp"
        app:layout_constraintLeft_toLeftOf="parent"
        android:layout_marginEnd="16dp"
        app:layout_constraintRight_toRightOf="parent" />

    <GridLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:columnCount="8"
        android:rowCount="5"
        android:useDefaultMargins="true"
        app:layout_constraintBottom_toBottomOf="parent"
        android:layout_marginBottom="32dp"
        android:foregroundGravity="center_horizontal"
        android:layout_marginStart="16dp"
        app:layout_constraintLeft_toLeftOf="parent"
        android:layout_marginEnd="16dp"
        app:layout_constraintRight_toRightOf="parent"
        android:layout_marginTop="8dp"
        app:layout_constraintTop_toBottomOf="@+id/editText"
        app:layout_constraintVertical_bias="0.81">

        <Button
            android:text="button"
            android:layout_width="88dp"
            android:background="@drawable/oval_btn"
            android:id="@+id/str_wa"
            android:layout_height="88dp"
            tools:layout_editor_absoluteY="520dp"
            tools:layout_editor_absoluteX="529dp" /> ・・・・・・

And you can place what you like.



来源:https://stackoverflow.com/questions/40851352/is-this-a-bug-at-android-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!