【问题标题】:Android -- SDK/IDE Layout Bug (w/Custom Layouts)?Android -- SDK/IDE 布局错误(带自定义布局)?
【发布时间】:2010-08-25 17:20:34
【问题描述】:

谁能告诉我这是否是 SDK/IDE 中的错误:

我添加到布局 XML 中的任何自定义或扩展布局都会导致 IDE 忽略该布局的任何子视图这一事实(它们只是从大纲视图/窗口中消失),从而使它们无法通过属性视图进行编辑/窗户。 (我需要扩展布局以使 onSetAlpha() 公开)

仅供参考:我正在为 Android 1.5 及更高版本进行开发,使用 Eclipse 中的所有最新插件/更新

这是一个简单的布局 XML 示例和导致此错误的扩展布局。

[扩展布局]

package com.test;
public class CustomLinearLayout extends LinearLayout
{

    public CustomLinearLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public CustomLinearLayout(Context context) {
        super(context);
    }
}

[简单布局 XML]

<?xml version="1.0" encoding="utf-8"?>
<com.test.CustomLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
  <ImageView android:id="@+id/ImageView01"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"></ImageView>
</com.test.CustomLinearLayout>

ImageView01 在属性或大纲视图/窗口中不可见或不可编辑。

谢谢。

【问题讨论】:

    标签: android ide layout sdk


    【解决方案1】:

    当您想编辑视图的属性时,只需替换您的 com.test.CustomLinearLayout 与线性布局。 然后您可以在属性中看到视图并可以编辑属性。完成编辑后,将标签恢复为原始标签,即从 LinearLayout 到 com.test.CustomLinearLayout

    【讨论】:

    • 感谢您的回复。这正是我自发布以来一直在做的事情,但我希望有一个修复或报告这实际上是一个错误。当您必须为多个自定义布局执行此操作时,必须来回切换会很痛苦。我无法想象这就是 Google 工程师打算让 IDE/SDK 做的事情。再次感谢。
    • 我也在做同样的事情。经过大量搜索,我发现除了这样做之外别无他法..
    猜你喜欢
    • 1970-01-01
    • 2014-04-22
    • 1970-01-01
    • 2016-11-09
    • 2014-06-25
    • 2016-09-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多