android studio preview无法显示布局

jason_705 2015-11-25 10:29:12

为什么xml布局会报空指针,可是程序又没报错,可以正常运行,看不到界面...android新手求助啊!!
...全文
7134 10 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
le0102 2015-11-27
  • 打赏
  • 举报
回复
结贴给分,谢谢
黄小楼 2015-11-26
  • 打赏
  • 举报
回复
把绿色的小机器人图标23改成22或者更低
jason_705 2015-11-26
  • 打赏
  • 举报
回复
引用 8 楼 jklwan 的回复:
[quote=引用 7 楼 qq_32921625 的回复:] <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:background="#ADD8E6"> <com.rey.material.widget.Button android:id="@+id/id_login" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:text="登入" app:v_styleId="@array/button_raise_wave_color"/> </LinearLayout> </RelativeLayout>
这个com.rey.material.widget.Button控件的代码问题,在onAttachedToWindow中添加对isInEditMode的判断就行了,下载源码用导入library再引用,修改onAttachedToWindow代码如下
@Override
protected void onAttachedToWindow() {
    super.onAttachedToWindow();
    if(mStyleId != 0) {
        if(!isInEditMode()){
        ThemeManager.getInstance().registerOnThemeChangedListener(this);
        onThemeChanged(null);}
    }
}
[/quote] 实在太感谢你了!!已经可以了!大神,以后可不可以跟你混了
jklwan 2015-11-26
  • 打赏
  • 举报
回复
引用 7 楼 qq_32921625 的回复:
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:background="#ADD8E6"> <com.rey.material.widget.Button android:id="@+id/id_login" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:text="登入" app:v_styleId="@array/button_raise_wave_color"/> </LinearLayout> </RelativeLayout>
这个com.rey.material.widget.Button控件的代码问题,在onAttachedToWindow中添加对isInEditMode的判断就行了,下载源码用导入library再引用,修改onAttachedToWindow代码如下
@Override
protected void onAttachedToWindow() {
    super.onAttachedToWindow();
    if(mStyleId != 0) {
        if(!isInEditMode()){
        ThemeManager.getInstance().registerOnThemeChangedListener(this);
        onThemeChanged(null);}
    }
}
jason_705 2015-11-26
  • 打赏
  • 举报
回复
引用 6 楼 jklwan 的回复:
[quote=引用 4 楼 qq_32921625 的回复:] 这该怎么解决?
布局的代码发一下[/quote] <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:background="#ADD8E6"> <include layout="@layout/activity_login_quick"/> <LinearLayout android:id="@+id/id_ll_main" android:layout_width="540dp" android:layout_height="240dp" android:layout_centerVertical="true" android:gravity="center" android:orientation="vertical" > <LinearLayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="2" android:background="#FFFFFF" android:gravity="center" android:orientation="vertical"> <com.zl.view.DeleteEditText android:id="@+id/id_name" android:layout_width="512dp" android:layout_height="wrap_content" android:singleLine="true" android:hint="测试" android:background="@drawable/exittext" /> <View android:layout_width="match_parent" android:layout_height="1dp" android:background="#D6D6D6"/> <com.zl.view.DeleteEditText android:id="@+id/id_password" android:layout_width="match_parent" android:layout_height="match_parent" android:inputType="textPassword" android:background="@drawable/exittext" android:layout_gravity="center_horizontal" /> </LinearLayout> <View android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:background="#ADD8E6"/> <!--<Button--> <!--android:id="@+id/id_login"--> <!--android:layout_width="match_parent"--> <!--android:layout_height="0dp"--> <!--android:layout_weight="1"--> <!--android:text="登入"/>--> <com.rey.material.widget.Button android:id="@+id/id_login" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:text="登入" app:v_styleId="@array/button_raise_wave_color"/> </LinearLayout> </RelativeLayout>
jklwan 2015-11-26
  • 打赏
  • 举报
回复
引用 4 楼 qq_32921625 的回复:
这该怎么解决?
布局的代码发一下
jason_705 2015-11-26
  • 打赏
  • 举报
回复
引用 3 楼 jklwan 的回复:
应该是这个com.rey.material.app.ThemeManager.....的错误,是控件的问题,无法绘制出来。



这该怎么解决?
jason_705 2015-11-26
  • 打赏
  • 举报
回复


这该怎么解决?
jklwan 2015-11-26
  • 打赏
  • 举报
回复
应该是这个com.rey.material.app.ThemeManager.....的错误,是控件的问题,无法绘制出来。
jason_705 2015-11-26
  • 打赏
  • 举报
回复
有改过了 但是还是一样的
更新时间2015-7-31左右 Android Studio 1.3 的新特性 性能 & 测试工具 Android Memory (HPROF) Viewer Android Studio 允许你可以用原生 Android HPROF 格式捕获和分析内存快照 Allocation Tracker 除了显示应用程序使用内存分配表,新的配置跟踪器现在包括一个可视化的方式,来查看您的应用程序分配。 APK Tests in Modules 应用程序的测试的灵活性方面,你现在得把你的代码测试在一个单独的模块,并使用新的测试插件(‘com.android.test’),该功能确实需要你的应用项目使用 Gradle Plugin 1.3。 Code 和 SDK 管理 App permission annotations Android Studio 现在支持内嵌代码的注释,以帮助您在 Android M 管理 app permissions。了解更多 code annotations. Data Binding Support 新的数据 brinding 特性,可让您通过将您的应用程序逻辑结合到你的布局,创建声明布局,用于最大限度地减少样板代码。了解更多 data binding. SDK Auto Update & SDK Manager 管理 Android SDK 更新现在是 Android Studio 的一部分. 默认下,Android Studio 会提示 SDK & Tool 更细. 你同也可以用新的集成的Android SDK Manager 调整你的偏好 C++ Support 作为 Android1.3 稳定版本的一部分,我们包括一个早期预览C ++编辑器,以及调试器支持搭配实验构建插件。查看Android C++ Preview 页面关于如何上手信息。更复杂的项目的支持和构建配置正在开发,让我们知道您的反馈意见。

80,472

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧