这是Android Studio的错误吗? [英] Is this a bug at Android Studio?

查看:80
本文介绍了这是Android Studio的错误吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使许多按钮的UI通过约束布局输入文本. 例如下面的图片.

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

但是,我感到奇怪的是,随着我放置更多的UI并允许设置我的自适应钩子,android studio变得非常慢,有时消失了(例如,某些按钮允许在图像上方显示Disapper头行).它应该使用非常大的内存,并且猜测可用内存以计算位置并重新渲染UI. 我可以避免这种情况吗?或使用其他布局制作相同UI的替代方法.对于这个问题,我感到非常紧张,因为我不了解制作网格灵活缩放UI的最佳方法.任何技巧都可以对我有所帮助.

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.

推荐答案

我可以使用包围按钮嵌套约束视图的网格布局解决问题,这似乎是相对定位UI的最佳方法.

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.

这篇关于这是Android Studio的错误吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆