本文整理匯總了Java中android.webkit.WebView.setLongClickable方法的典型用法代碼示例。如果您正苦於以下問題:Java WebView.setLongClickable方法的具體用法?Java WebView.setLongClickable怎麽用?Java WebView.setLongClickable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.webkit.WebView
的用法示例。
在下文中一共展示了WebView.setLongClickable方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCreate
import android.webkit.WebView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
setContentView(R.layout.activity_article);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setTitle(getString(R.string.emptyField));
if (Content.article.getTitle() != null) {
actionBar.setTitle(Content.article.getTitle());
}
}
ImageView imgAvatar = (ImageView) findViewById(R.id.imgAvatar);
String link = APIConstants.SONO_AVATAR + Content.article.getAuthorAvatar();
Picasso.with(this).load(link).placeholder(R.drawable.ic_user).error(R.drawable.ic_user)
.into(imgAvatar);
TextView txtTitle = (TextView) findViewById(R.id.txtTitle);
txtTitle.setText(getString(R.string.emptyField));
if (Content.article.getTitle() != null) {
txtTitle.setText(Content.article.getTitle());
}
TextView txtAuthor = (TextView) findViewById(R.id.txtAuthor);
txtAuthor.setText(getString(R.string.emptyField));
if (Content.article.getAuthor() != null) {
txtAuthor.setText(Content.article.getAuthor());
}
TextView txtDate = (TextView) findViewById(R.id.txtDate);
String dateString = getString(R.string.emptyField);
if (Content.article.getDate() != null) {
dateString = new SimpleDateFormat("EEEE d MMMM yyyy")
.format(Content.article.getDate());
}
txtDate.setText(dateString);
WebView wvContent = (WebView) findViewById(R.id.wvContent);
wvContent.setBackgroundColor(Color.TRANSPARENT);
wvContent.setHapticFeedbackEnabled(false);
wvContent.getSettings().setDefaultFontSize(15);
wvContent.setClickable(false);
wvContent.setLongClickable(false);
wvContent.getSettings().setJavaScriptEnabled(false);
wvContent.loadData("" +
"<body style=\"text-align: justify;\">" + Content.article.getContent()
.replace("\n", "<br/>") + "</body>",
"text/html; charset=UTF-8", null);
}