Shiino 2017-03-27 18:51 采纳率: 0%
浏览 13717

Android studio报错 view is not constrained....

content_main.xml
//在两个button和LinearLayout下都有这个错误,看了半天注释,似乎是要约束组件的位置?但内层的EditText却没有这个错误,试了很多方法都没法解决

<?xml version="1.0" encoding="utf-8"?>
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="com.example.ryo.myapplication.MainActivity">

<Button
    android:id="@+id/button3"
    style="@style/Widget.AppCompat.Button.Borderless"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:fadingEdge="horizontal|vertical"
    android:text="@string/Login_Button_1"
    tools:layout_editor_absoluteX="67dp"
    tools:layout_editor_absoluteY="503dp" />

<Button
    android:id="@+id/button"
    style="@style/Widget.AppCompat.Button.Borderless"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:fadingEdge="horizontal|vertical"
    android:text="@string/Login_Button"
    tools:layout_editor_absoluteX="227dp"
    tools:layout_editor_absoluteY="503dp" />

<LinearLayout
    android:id="@+id/Login_text1"
    android:layout_width="385dp"
    android:layout_height="164dp"
    android:layout_alignLeft="@+id/button"
    android:layout_alignStart="@+id/button"
    android:layout_centerVertical="true"
    android:layout_marginTop="-23dp"
    android:orientation="vertical"
    android:weightSum="1"
    app:layout_constraintTop_toTopOf="parent"
    tools:layout_editor_absoluteX="0dp">

    <EditText
        android:id="@+id/editText"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="0.40"
        android:ems="10"
        android:hint="@string/Login_UserName"
        android:inputType="textPersonName" />

    <EditText
        android:id="@+id/editText2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="0.51"
        android:ems="10"
        android:hint="@string/Login_Password"
        android:inputType="textPassword" />

</LinearLayout>

  • 写回答

3条回答

  • LevMe 2017-03-28 01:37
    关注

    能不能把content_main.xml完整的贴出来呢

    评论

报告相同问题?

悬赏问题

  • ¥15 有赏,i卡绘世画不出
  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码