NovelReader
NovelReader copied to clipboard
想在最后一页添加个插图,怎么操作啊
我是在这块代码位置添加的
//对内容进行绘制
for (int i = mCurPage.titleLines; i < mCurPage.lines.size(); ++i) {
str = mCurPage.lines.get(i);
canvas.drawText(str, mMarginWidth, top, mTextPaint);
if (str.endsWith("\n")) {
top += para;
} else {
top += interval;
}
}
if (mCurPage.position + 1 == mCurPageList.size()) {
if (null != mCurPage.nativeADDataRef) {
// TODO: 2018/6/13 绘制插图
// View view = mCurPage.view;
View view = LayoutInflater.from(App.getContext()).inflate(R.layout.aa_ad_big, null);
ImageView imageView = (ImageView) view.findViewById(R.id.img_ad_big);
// Glide.with(App.getContext()).load(mCurPage.nativeADDataRef.getImgUrl()).asBitmap().into(imageView);
Bitmap viewBitmap = getViewBitmap(imageView, (int) top, titlePara, mTitleInterval);
// Bitmap viewBitmap = getViewBitmap(view);
if (viewBitmap != null)
canvas.drawBitmap(viewBitmap, mMarginWidth, -mTextPaint.getFontMetrics().top , mBgPaint);
}
}
使用本地插图可以,已加载网络插图,就不行了,版主可以指导下么
解决了
求指导啊!!咋实现的
你是打算拿来搞广告吧?
显示内容位置不够,如何加一页添加自定义view?
解决了
你好,怎么实现的这个然后可以交互啊,求助
解决了 这个是怎么解决的,谢谢
没搞定啊,我只是给最后加了个空白页,悬浮了个插图,只看起来是在上面
------------------ 原始邮件 ------------------ 发件人: "nances"[email protected]; 发送时间: 2019年5月14日(星期二) 中午12:33 收件人: "newbiechen1024/NovelReader"[email protected]; 抄送: "秋夏天"[email protected]; "Comment"[email protected]; 主题: Re: [newbiechen1024/NovelReader] 想在最后一页添加个插图,怎么操作啊 (#54)
解决了 这个是怎么解决的,谢谢
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
@wuzeqiu 你是通过Canvas 画了一个空白地方,然后再放个布局在上面的吧
嗯,就是这个思路
------------------ 原始邮件 ------------------ 发件人: "nances"[email protected]; 发送时间: 2019年5月14日(星期二) 下午5:06 收件人: "newbiechen1024/NovelReader"[email protected]; 抄送: "秋夏天"[email protected];"Mention"[email protected]; 主题: Re: [newbiechen1024/NovelReader] 想在最后一页添加个插图,怎么操作啊 (#54)
@wuzeqiu 你是通过Canvas 画了一个空白地方,然后再放个布局在上面的吧
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
哈哈哈,也是个思路
在 2019-05-14 17:41:10,"wuzeqiu" [email protected] 写道: 嗯,就是这个思路
------------------ 原始邮件 ------------------ 发件人: "nances"[email protected]; 发送时间: 2019年5月14日(星期二) 下午5:06 收件人: "newbiechen1024/NovelReader"[email protected]; 抄送: "秋夏天"[email protected];"Mention"[email protected]; 主题: Re: [newbiechen1024/NovelReader] 想在最后一页添加个插图,怎么操作啊 (#54)
@wuzeqiu 你是通过Canvas 画了一个空白地方,然后再放个布局在上面的吧
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
@wuzeqiu 你这边是怎么设置的,我设置最后一个空白页,但是好像把下一章节的内容第一页的内容给占用了
你看看你自己代码,怎么进行章节划分的,每个章节有自己的页数,页数+1,最后一页,就去绘制图就好了啊
------------------ 原始邮件 ------------------ 发件人: "nances"[email protected]; 发送时间: 2019年5月16日(星期四) 下午2:54 收件人: "newbiechen1024/NovelReader"[email protected]; 抄送: "秋夏天"[email protected];"Mention"[email protected]; 主题: Re: [newbiechen1024/NovelReader] 想在最后一页添加个插图,怎么操作啊 (#54)
@wuzeqiu 你这边是怎么设置的,我设置最后一个空白页,但是好像把下一章节的内容第一页的内容给占用了
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
@wuzeqiu
// TODO: 2018/6/13 绘制插图 Log.v("TAG", "======1 == mCurPage.isAD=======" + mCurPage.isAD); if (1 == STATUS_CATEGORY_AD) { Paint.FontMetrics fontMetrics = mTextPaint.getFontMetrics(); float textHeight = fontMetrics.top - fontMetrics.bottom; float textWidth = mTextPaint.measureText("我要留给一个空白页在这里,你大爷"); float pivotX = (mDisplayWidth - textWidth) / 2; float pivotY = (mDisplayHeight - textHeight) / 2; canvas.drawText("", 0, 0, mTextPaint); STATUS_CATEGORY_AD = 0; } else {
//对标题进行绘制
for (int i = 0; i < mCurPage.titleLines; ++i) {
str = mCurPage.lines.get(i);
//设置顶部间距
if (i == 0) {
top += mTitlePara;
}
//计算文字显示的起始点
int start = (int) (mDisplayWidth - mTitlePaint.measureText(str)) / 2;
//进行绘制
canvas.drawText(str, start, top, mTitlePaint);
//设置尾部间距
if (i == mCurPage.titleLines - 1) {
top += titlePara;
} else {
//行间距
top += titleInterval;
}
}
//对内容进行绘制
for (int i = mCurPage.titleLines; i < mCurPage.lines.size(); ++i) {
str = mCurPage.lines.get(i);
canvas.drawText(str, mMarginWidth, top, mTextPaint);
if (str.endsWith("\n")) {
top += para;
} else {
top += interval;
}
}
Log.v("TAG", "mCurPage.position" + mCurPage.position);
if (mCurPage.position + 1 == mCurPageList.size() || (mCurPage.position + 1) == 1) {
Log.v("TAG", "======绘制插图=======");
STATUS_CATEGORY_AD = 1;
}
不是这里,你这里都到绘制了,前面还有个步骤,计算页数的
------------------ 原始邮件 ------------------ 发件人: "nances"[email protected]; 发送时间: 2019年5月16日(星期四) 下午2:57 收件人: "newbiechen1024/NovelReader"[email protected]; 抄送: "秋夏天"[email protected]; "Mention"[email protected]; 主题: Re: [newbiechen1024/NovelReader] 想在最后一页添加个插图,怎么操作啊 (#54)
@wuzeqiu
// TODO: 2018/6/13 绘制插图
Log.v("TAG", "======1 == mCurPage.isAD=======" + mCurPage.isAD);
if (1 == STATUS_CATEGORY_AD) {
Paint.FontMetrics fontMetrics = mTextPaint.getFontMetrics();
float textHeight = fontMetrics.top - fontMetrics.bottom;
float textWidth = mTextPaint.measureText("我要留给一个空白页在这里,你大爷");
float pivotX = (mDisplayWidth - textWidth) / 2;
float pivotY = (mDisplayHeight - textHeight) / 2;
canvas.drawText("", 0, 0, mTextPaint);
STATUS_CATEGORY_AD = 0;
} else {
//对标题进行绘制 for (int i = 0; i < mCurPage.titleLines; ++i) { str = mCurPage.lines.get(i); //设置顶部间距 if (i == 0) { top += mTitlePara; } //计算文字显示的起始点 int start = (int) (mDisplayWidth - mTitlePaint.measureText(str)) / 2; //进行绘制 canvas.drawText(str, start, top, mTitlePaint); //设置尾部间距 if (i == mCurPage.titleLines - 1) { top += titlePara; } else { //行间距 top += titleInterval; } } //对内容进行绘制 for (int i = mCurPage.titleLines; i < mCurPage.lines.size(); ++i) { str = mCurPage.lines.get(i); canvas.drawText(str, mMarginWidth, top, mTextPaint); if (str.endsWith("\n")) { top += para; } else { top += interval; } } Log.v("TAG", "mCurPage.position" + mCurPage.position); if (mCurPage.position + 1 == mCurPageList.size() || (mCurPage.position + 1) == 1) { Log.v("TAG", "======绘制插图======="); STATUS_CATEGORY_AD = 1; }
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
@wuzeqiu 你邮箱多少,私聊?
https://github.com/itwangyu/NovelReaderAdDemo 这个可以增加自定义布局,但是上下滑动无法点击,大家一起讨论一下能不能解决!
@KotlinLan 我也遇到了相同的问题 问题解决了吗
没
------------------ 原始邮件 ------------------ 发件人: "侯佳佳"<[email protected]>; 发送时间: 2020年11月5日(星期四) 下午3:17 收件人: "newbiechen1024/NovelReader"<[email protected]>; 抄送: "秋夏天"<[email protected]>; "Mention"<[email protected]>; 主题: Re: [newbiechen1024/NovelReader] 想在最后一页添加个插图,怎么操作啊 (#54)
@KotlinLan 我也遇到了相同的问题 问题解决了吗
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
@Airmour 没有。
https://github.com/itwangyu/NovelReaderAdDemo 这个可以增加自定义布局,但是上下滑动无法点击,大家一起讨论一下能不能解决!
上下滑动可以设置vip,vip免广告 绝了!