首先,我看到了这个问题:使用Android的RecyclerView时,在滑动的行下添加带有文本/图标的彩色背景
但是,即使标题声明"带有文本/图标",答案也仅涵盖使用Canvas对象绘制矩形.
现在我已经绘制了一个绿色矩形; 但是我想通过添加"完成"按钮来更明显地发生什么,就像在下面的截图中一样.
我创建了一个自定义视图:
public class ChoosePlanView extends LinearLayout{
public ChoosePlanView(Context context) {
super(context);
init();
}
public ChoosePlanView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public ChoosePlanView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init();
}
private void init(){
View v = inflate(getContext(), R.layout.choose_plan_view, null);
addView(v);
}
}
Run Code Online (Sandbox Code Playgroud)
布局非常简单,包括绿色背景和图标:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/choose_green">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/doneIcon"
android:layout_gravity="center_horizontal|right"
android:src="@mipmap/done"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
我尝试重写方法OnChildDraw:
// ChoosePlanView choosePlanView; <- that was declared and …Run Code Online (Sandbox Code Playgroud) 我正在寻找类似"倒置非对称密码术"的东西,并且遇到了一个很棒的帖子,它实际上涵盖了我需要的东西.
我希望我的应用程序的每个用户都有一个公钥,允许他们解密隐藏在用我的私钥加密的QR码中的消息.我想确保我的系统不会被覆盖我的假QR码欺骗.接受的答案建议使用数字签名,所以我搜索了Java教程,展示了如何使用该功能.
这有点误会了.我认为使用数字签名会有一个简单的情况(让我们称之为Situation A):
但是,我的理解是数字签名更像是:
我在这儿吗?如果是这样,我如何将我的消息和签名放在QR码中?事情似乎很容易,Situation A因为我只能使用Base64编码加密的消息,并将结果放在QR码中.然而,看起来我不能不使用像这样的技巧做同样的事情encode message, encode signature, put them in one file, encode it, put the result in the code.那我该怎么办?
你可以把QR码你想要的任何东西,包括代表签名的文档的Base-64编码的字节.没有读者会知道如何处理它; 你必须写扫描,然后知道将其解码并采取相应的行动定制的应用程序.
根据提到的教程前面看起来签名文档本身是不够的,虽然.