android - Android涂抹布局

标签 android android-layout android-emulator

我从未见过这样的事情,我的布局只是在我的设备(运行Android 4.4.2的Infinix Zero X506)上弄脏了,但是在模拟器上它显示得很好,我无法弄清楚原因,而且我没有在这里或在Google上也看到了类似的问题。我正在使用Android Studio 2.2预览版1
下面是一张图片
Layout Screenshot

下面是我的布局xml

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:layout_margin="@dimen/activity_horizontal_margin">
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">
    <TextView
        android:text="@string/title"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/textView"
        android:textStyle="bold"/>

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="textCapSentences"
        android:hint="@string/enter_title"
        android:ems="10"
        android:maxLines="2"
        android:id="@+id/edName" />

    <TextView
        android:text="@string/to_do_details"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/textView2"
        android:textStyle="bold"
        android:layout_marginTop="10dp"/>

    <EditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="textMultiLine|textCapSentences"
        android:ems="10"
        android:hint="@string/enter_to_do_details"
        android:id="@+id/edDetails" />

    <TextView
        android:text="@string/select_priority"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/textView3"
        android:textStyle="bold"
        android:layout_marginTop="10dp"/>

    <Spinner
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/spPriority"
        />
    <TextView
        android:text="@string/set_time"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/textView6"
        android:textStyle="bold"
        android:layout_marginTop="10dp"/>
    <Button
        android:background="@color/colorAccent"
        android:textStyle="bold"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:id="@+id/btDate"
        />
    <TextView
        android:text="@string/set_date"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/textView4"
        android:textStyle="bold"
        android:layout_marginTop="10dp"/>

    <Button
        android:background="@color/colorAccent"
        android:textStyle="bold"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:id="@+id/btTime"
        />

    <Button
        android:layout_marginTop="@dimen/activity_vertical_margin"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/button"
        android:text="@string/save"
        android:gravity="center"
        android:layout_gravity="center"/>
 </LinearLayout>
</ScrollView>

如果有帮助,微调器中的条目来自自定义适配器

最佳答案

已通过Android Studio 2.2 Preview 4 确认已解决

因此,您不再需要还原为原始答案说明的插件版本2.1.0。

原始答案:

这是gradle插件的alpha版本存在的问题。如果将插件版本还原为2.1.0,则可以继续使用Android Studio 2.2,如下所示:

buildscript {

    ...

    dependencies {
        // other entries here
        classpath 'com.android.tools.build:gradle:2.1.0'
    }

    ...

}

在您的根项目中build.gradle
请投票将问题固定在the official bug tracker entry here

关于android - Android涂抹布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37939770/

相关文章:

android - 调用带 * 字符的电话号码

java - 设置新的 setContentView 时 MediaPlayer 被销毁

android - WebView 中的 YouTube 移动网站上的视频不起作用 - Android

android - 动态创建 Buttons 并设置 onClickListener

android - EditText,当转到多行时,搞乱了约束布局android

Android 根据屏幕尺寸缩放文本和图像(手机与平板电脑)

Android M Preview 3 模拟器 native 浏览器崩溃

android - 模拟器不加载

android - 支持不同的屏幕,基于维度还是基于 dpi?

android - 如何使标题不随列表滚动?