当前位置: 首页>>代码示例>>Java>>正文


Java HtmlTextView.setHtml方法代码示例

本文整理汇总了Java中org.sufficientlysecure.htmltextview.HtmlTextView.setHtml方法的典型用法代码示例。如果您正苦于以下问题:Java HtmlTextView.setHtml方法的具体用法?Java HtmlTextView.setHtml怎么用?Java HtmlTextView.setHtml使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.sufficientlysecure.htmltextview.HtmlTextView的用法示例。


在下文中一共展示了HtmlTextView.setHtml方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreateView

import org.sufficientlysecure.htmltextview.HtmlTextView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_station_trivia, container, false);

    IntentFilter filter = new IntentFilter();
    filter.addAction(StationActivity.ACTION_MAIN_SERVICE_BOUND);
    LocalBroadcastManager bm = LocalBroadcastManager.getInstance(getContext());
    bm.registerReceiver(mBroadcastReceiver, filter);

    triviaView = (HtmlTextView) view.findViewById(R.id.trivia_view);

    triviaView.setHtml(getString(R.string.status_loading));
    update();

    return view;
}
 
开发者ID:gbl08ma,项目名称:underlx,代码行数:19,代码来源:StationTriviaFragment.java

示例2: onCreateView

import org.sufficientlysecure.htmltextview.HtmlTextView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_changelog, container, false);

    HtmlTextView changelogText = (HtmlTextView) view.findViewById(R.id.changelogText);
    try {
        String html = new Markdown4jProcessor().process(
                getActivity().getResources().openRawResource(R.raw.changelog));
        changelogText.setHtml(html, new HtmlResImageGetter(changelogText));
    } catch (IOException e) {
        Log.e("UniPatcher", "IOException", e);
    }

    return view;
}
 
开发者ID:btimofeev,项目名称:UniPatcher,代码行数:17,代码来源:ChangelogFragment.java

示例3: onCreateView

import org.sufficientlysecure.htmltextview.HtmlTextView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_about, container, false);

    TextView versionText = (TextView) view.findViewById(R.id.versionText);
    versionText.setText(getString(R.string.help_activity_about_tab_version, Utils.getAppVersion(getActivity())));
    HtmlTextView aboutText = (HtmlTextView) view.findViewById(R.id.aboutText);
    try {
        String html = new Markdown4jProcessor().process(
                getActivity().getResources().openRawResource(R.raw.about));
        aboutText.setHtml(html, new HtmlResImageGetter(aboutText));
    } catch (IOException e) {
        Log.e("UniPatcher", "IOException", e);
    }

    return view;
}
 
开发者ID:btimofeev,项目名称:UniPatcher,代码行数:19,代码来源:AboutFragment.java

示例4: createHtmlInfoDialog

import org.sufficientlysecure.htmltextview.HtmlTextView; //导入方法依赖的package包/类
private static AlertDialog createHtmlInfoDialog(Context context, int titleId, Integer messageId, String message, boolean largeText, boolean textIsSelectable) {
    if (messageId == null && message == null)
        throw new IllegalArgumentException("MessageId or message values is required");
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    LayoutInflater inflater = LayoutInflater.from(context);
    View dialogLayout = inflater.inflate(R.layout.html_information_dialog, null);
    builder.setView(dialogLayout);
    builder.setPositiveButton(R.string.dialog_ok, null);

    builder.setTitle(titleId);
    HtmlTextView messageView = (HtmlTextView) dialogLayout.findViewById(R.id.html_info_dialog_textview);
    messageView.setTextAppearance(context, (largeText ? android.R.style.TextAppearance_Medium : android.R.style.TextAppearance_Small));
    if (messageId != null) {
        messageView.setHtml(messageId, new HtmlResImageGetter(messageView));
    } else {
        messageView.setHtml(message, new HtmlResImageGetter(messageView));
    }
    // don't move above settings content because it won't work
    messageView.setTextIsSelectable(textIsSelectable);

    AlertDialog dialog = builder.create();
    dialog.setCanceledOnTouchOutside(true);
    return dialog;
}
 
开发者ID:zamojski,项目名称:TowerCollector,代码行数:25,代码来源:DialogManager.java

示例5: onCreateDialog

import org.sufficientlysecure.htmltextview.HtmlTextView; //导入方法依赖的package包/类
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity())
            .setTitle(R.string.dialog_startup_title)
            .setNegativeButton(R.string.dialog_startup_negative_button, null)
            .setPositiveButton(R.string.dialog_startup_positive_button, onPositiveButtonClickListener);
    // Get the layout inflater
    LayoutInflater inflater = getActivity().getLayoutInflater();
    View viewRoot = inflater.inflate(R.layout.dialog_startup, null);
    HtmlTextView htmlTextView = (HtmlTextView) viewRoot.findViewById(R.id.html_text);

    String htmlContent =
            "<p>"+getString(R.string.html_text_purpose)+"</p>"+
            "<p>"+getString(R.string.html_text_free)+"</p>"+
            "<p>"+getString(R.string.html_text_donation)+"</p>";

    htmlTextView.setHtml(htmlContent);
    builder.setView(viewRoot);

    return builder.create();
}
 
开发者ID:Kunzisoft,项目名称:RememBirthday,代码行数:22,代码来源:StartupDialogFragment.java

示例6: onCreate

import org.sufficientlysecure.htmltextview.HtmlTextView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if(getSupportActionBar() != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }

    setContentView(R.layout.activity_about);
    HtmlTextView htmlTextView = (HtmlTextView) findViewById(R.id.html_text);
    htmlTextView.setHtml(R.raw.privacypolicy);

}
 
开发者ID:mo3rfan,项目名称:syncplayer,代码行数:13,代码来源:privacyPolicy.java

示例7: onCreate

import org.sufficientlysecure.htmltextview.HtmlTextView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if(getSupportActionBar() != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    }
    setContentView(R.layout.activity_about);

    HtmlTextView htmlTextView = (HtmlTextView) findViewById(R.id.html_text);
    htmlTextView.setHtml(R.raw.about);

}
 
开发者ID:mo3rfan,项目名称:syncplayer,代码行数:13,代码来源:AboutActivity.java

示例8: onCreateDialog

import org.sufficientlysecure.htmltextview.HtmlTextView; //导入方法依赖的package包/类
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    String content = "";
    boolean isHtml = false;
    if (getArguments() != null) {
        content = getArguments().getString(ARG_CONTENT);
        isHtml = getArguments().getBoolean(ARG_HTML);
    }
    LayoutInflater inflater = getActivity().getLayoutInflater();

    View view = inflater.inflate(R.layout.dialog_html, null);

    HtmlTextView htmltv = (HtmlTextView) view.findViewById(R.id.html_view);
    if (isHtml) {
        htmltv.setHtml(content);
    } else {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            htmltv.setTextAppearance(R.style.TextAppearance_AppCompat_Small);
        } else {
            htmltv.setTextAppearance(getContext(), R.style.TextAppearance_AppCompat_Small);
        }
        htmltv.setText(content);
    }

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setView(view);
    return builder.create();
}
 
开发者ID:gbl08ma,项目名称:underlx,代码行数:29,代码来源:HtmlDialogFragment.java

示例9: onCreateView

import org.sufficientlysecure.htmltextview.HtmlTextView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_faq, container, false);
    HtmlTextView faqText = (HtmlTextView) view.findViewById(R.id.faqText);
    try {
        String html = new Markdown4jProcessor().process(
                getActivity().getResources().openRawResource(R.raw.faq));
        faqText.setHtml(html, new HtmlResImageGetter(faqText));
    } catch (IOException e) {
        Log.e("UniPatcher", "IOException", e);
    }

    return view;
}
 
开发者ID:btimofeev,项目名称:UniPatcher,代码行数:16,代码来源:FaqFragment.java

示例10: onCreateView

import org.sufficientlysecure.htmltextview.HtmlTextView; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    rootLayout = (RelativeLayout) inflater.inflate(R.layout.fragment_about, container, false);

    icon = (ImageView) rootLayout.findViewById(R.id.appIcon);
    try {
        icon.setImageDrawable(getActivity().getPackageManager().getApplicationIcon("com.chris.randomrestaurantgenerator"));
    } catch (PackageManager.NameNotFoundException e) {
        e.printStackTrace();
    }

    appVersion = (TextView) rootLayout.findViewById(R.id.appVersion);
    appVersion.setText(String.format("Version: %s", BuildConfig.VERSION_NAME));

    githubLink = (TextView) rootLayout.findViewById(R.id.githubLink);
    githubLink.setMovementMethod(LinkMovementMethod.getInstance());

    String htmlLink = "<a href='https://github.com/christarazi/random-restaurant-generator'> Source code</a>";
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
        githubLink.setText(Html.fromHtml(htmlLink, Html.FROM_HTML_MODE_LEGACY));
    }
    else {
        githubLink.setText(Html.fromHtml(htmlLink));
    }

    htmlAbout = (HtmlTextView) rootLayout.findViewById(R.id.htmlAbout);
    htmlAbout.setHtml(R.raw.about, new Html.ImageGetter() {
        @Override
        public Drawable getDrawable(String s) {
            return null;
        }
    });

    return rootLayout;
}
 
开发者ID:christarazi,项目名称:random-restaurant-generator,代码行数:38,代码来源:AboutFragment.java

示例11: newPush

import org.sufficientlysecure.htmltextview.HtmlTextView; //导入方法依赖的package包/类
/**
 * 有新消息推送
 *
 * @param post
 */
@Override
public void newPush(final RecentPost post) {
    AccountApp.isPushed = true;
    // 显示重要消息的对话框
    AlertDialog.Builder builder = AccountApp.getAlertDialogBuilder(this);
    View dialogView = LayoutInflater.from(this)
            .inflate(R.layout.dialog_push, null);
    builder.setView(dialogView);
    final AlertDialog dialog = builder.create();
    dialog.setCanceledOnTouchOutside(false);
    Button btnOK = (Button) dialogView.findViewById(R.id.btnOK);
    TextView tvTitle = (TextView) dialogView.findViewById(R.id.tvTitle);
    TextView tvDate = (TextView) dialogView.findViewById(R.id.tvDate);
    HtmlTextView tvContent = (HtmlTextView) dialogView.findViewById(R.id.tvContent);

    tvTitle.setText(post.getTitle());
    tvDate.setText("发布日期:" + post.getDate());
    tvContent.setHtml(post.getContent());
    btnOK.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            AccountApp.pushID = post.getId();
            AccountApp.getInstance().editor.putInt(Constants.PUSH_ID, AccountApp.pushID).apply();
            dialog.dismiss();
        }
    });
    dialog.show();
}
 
开发者ID:liying2008,项目名称:neu-ipgw,代码行数:34,代码来源:MainActivity.java

示例12: onCreate

import org.sufficientlysecure.htmltextview.HtmlTextView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    HtmlTextView textView = (HtmlTextView) findViewById(R.id.html_text);

    //text.setRemoveFromHtmlSpace(false); // default is true
    textView.setClickableTableSpan(new ClickableTableSpanImpl());
    DrawTableLinkSpan drawTableLinkSpan = new DrawTableLinkSpan();
    drawTableLinkSpan.setTableLinkText("[tap for table]");
    textView.setDrawTableLinkSpan(drawTableLinkSpan);

    textView.setHtml(R.raw.example, new HtmlResImageGetter(textView));
}
 
开发者ID:PrivacyApps,项目名称:html-textview,代码行数:16,代码来源:MainActivity.java

示例13: displayHtml

import org.sufficientlysecure.htmltextview.HtmlTextView; //导入方法依赖的package包/类
/**
 * This method will be used by data binding when we use app:html in XML.
 * BindingAdapters only need to be declared once and usable in the whole app.
 * Its better to put all BindingAdapters in a single Java file.
 *
 * @param view The {@link HtmlTextView}
 * @param html The value from {@link NewsItem#getHtml()}
 */
@BindingAdapter({"html"})
public static void displayHtml(HtmlTextView view, @Nullable String html) {
    view.setHtml(html, new HtmlResImageGetter(view));
}
 
开发者ID:SysdataSpA,项目名称:SDHtmlTextView,代码行数:13,代码来源:DataBindingExampleActivity.java


注:本文中的org.sufficientlysecure.htmltextview.HtmlTextView.setHtml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。