我在Google上下载了一款Android应用。其中的一些布局能够在图形布局中查看,而其他布局则不具有此布局
的示例<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:camera="http://schemas.android.com/apk/res/com.android.camera"
android:background="@drawable/ic_launcher"
android:id="@+id/camera"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.android.camera.PreviewFrameLayout android:id="@+id/frame_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="2dp"
android:layout_weight="1">
<FrameLayout android:id="@+id/frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/ic_launcher">
<SurfaceView android:id="@+id/camera_preview"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<com.android.camera.FocusRectangle
android:id="@+id/focus_rectangle"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</FrameLayout>
</com.android.camera.PreviewFrameLayout>
我在下面说了这些话:
渲染期间引发异常:com.android.layoutlib.bridge.MockView无法强制转换为android.view.ViewGroup Window&gt;中记录了异常详细信息。显示视图&gt;错误日志 找不到以下类: - com.android.camera.PreviewFrameLayout(修复构建路径,编辑XML,创建类)。
答案 0 :(得分:0)
这是因为您没有 PreviewFrameLayout 类。请找到它并将其包含在您的包中
答案 1 :(得分:0)
com.android.camera.PreviewFrameLayout
com.android.camera.FocusRectangle
您应该在相应的包中拥有以上自定义类。
package com.example.scrollview;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.ScrollView;
public class TextScroll extends ScrollView {
private TextScrollListener scrollListener = null;
public TextScroll(Context context) {
super(context);
}
public TextScroll(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public TextScroll(Context context, AttributeSet attrs) {
super(context, attrs);
}
public void setScrollViewListener(TextScrollListener scrollViewListener) {
this.scrollListener = scrollViewListener;
}
@Override
protected void onScrollChanged(int l, int t, int oldl, int oldt) {
super.onScrollChanged(l, t, oldl, oldt);
if (scrollListener != null) {
scrollListener.onScrollChanged(this, l, t, oldl, oldt);
}
}
}
的example.xml
<com.example.scrollview
android:layout_width="wrap_content"
android:layout_height="wrapcontent"
>
</com.example.scrollview>