現象如圖:右下角有個剩下字數統計。但是當變成負數的時候居然還是可以分享成功。
於是就得限制負數不能分享。
解決方案:
在cn.sharesdk.onekeyshare.theme.classic包的EditPage.java裏,在onClick()裏的
<span style="font-size:18px;">if (v.equals(llTitle.getBtnRight())) 後面<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);">加上一句判斷代碼:如下</span></span>
<span style="font-size:18px;">if (v.equals(llTitle.getBtnRight())) {
if (Integer.valueOf(tvCounter.getText().toString()) < 0 &&
platformList != null && platformList.length > 0 &&
platformList[0].getName().equals(SinaWeibo.NAME)) {
<span style="white-space:pre"> </span>Toast.makeText(activity, "超過字數上限,請重輸", Toast.LENGTH_LONG).show();
return;
}</span>
<span style="font-size:18px;"><span style="white-space:pre"> </span>...</span>
<span style="font-size:18px;">}</span>
自此,當微博分享超過140字的時候提示 超過字數上限,請重試