我已经创建了recycler view
,offset item decoration
并在列表项中添加了并添加了海拔高度属性,但是它不起作用。请帮忙!!
这就是我要的
是)我有的
我的抵销商品装饰代码
public class ItemOffsetDecoration extends RecyclerView.ItemDecoration {
private int mItemOffset;
private ItemOffsetDecoration(int itemOffset) {
mItemOffset = itemOffset;
}
public ItemOffsetDecoration(@NonNull Context context, @DimenRes int itemOffsetId) {
this(context.getResources().getDimensionPixelSize(itemOffsetId));
}
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent,
RecyclerView.State state) {
super.getItemOffsets(outRect, view, parent, state);
outRect.set(mItemOffset, mItemOffset, mItemOffset, mItemOffset);
}
}
Run Code Online (Sandbox Code Playgroud)
这是添加Card View
和使用elevation
属性后的清单项目。
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:focusable="true"
android:longClickable="true"
android:orientation="vertical"
android:paddingBottom="10dp" …
Run Code Online (Sandbox Code Playgroud) 我有一个这样定义的Java类:
class GlslProgram
{
public:
class Format {
public:
Format& vertex(const char* shader_path);
std::string m_vertex_shader;
private:
std::string load_shader(const char* shader_path);
};
void use() const;
void uniform(const GLchar* name, const GLboolean value) const;
GlslProgram() {};
GlslProgram(const Format& format, const bool separable = false);
private:
GLuint m_handle;
GLuint compile_shader(const std::string shader_string, const GLenum
};
Run Code Online (Sandbox Code Playgroud)
第二个构造函数(即,GlslProgram(const Format& format, const bool separable = false);
是我唯一想要使用或可用的构造函数。
我想删除默认的构造函数(或使其私有),但是不能这样做,因为我必须GlslProgram
在应用程序中声明(未初始化的)实例作为另一个类的成员。
即
class BasicCubeExample : public Application
{
private:
virtual void set_info()
{
Application::set_info();
m_info.title = …
Run Code Online (Sandbox Code Playgroud)