gpt4 book ai didi

Android——SDK/IDE 布局错误(带自定义布局)?

转载 作者:行者123 更新时间:2023-11-29 14:11:16 24 4
gpt4 key购买 nike

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

我添加到我的布局 XML 中的任何自定义或扩展布局都会导致 IDE 忽略该布局的任何 subview 这一事实(它们只是从大纲 View /窗口中消失),从而使它们无法通过属性 View 进行编辑/ window 。 (我需要扩展布局以使 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 在属性或大纲 View /窗口中不可见或不可编辑。

谢谢。

最佳答案

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

关于Android——SDK/IDE 布局错误(带自定义布局)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2942941/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com