本文整理匯總了Java中android.widget.TextView.setMaxHeight方法的典型用法代碼示例。如果您正苦於以下問題:Java TextView.setMaxHeight方法的具體用法?Java TextView.setMaxHeight怎麽用?Java TextView.setMaxHeight使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.TextView
的用法示例。
在下文中一共展示了TextView.setMaxHeight方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onPrompt
import android.widget.TextView; //導入方法依賴的package包/類
@Override
public void onPrompt(UpdateAgent agent) {
final UpdateInfo info = agent.getInfo();
String size = Formatter.formatShortFileSize(mContext, info.size);
String content = String.format("最新版本:%1$s\n新版本大小:%2$s\n\n更新內容\n%3$s", info.versionName, size, info.updateContent);
final AlertDialog dialog = new AlertDialog.Builder(mContext).create();
dialog.setTitle("應用更新");
dialog.setCancelable(false);
dialog.setCanceledOnTouchOutside(false);
float density = mContext.getResources().getDisplayMetrics().density;
TextView tv = new TextView(mContext);
tv.setMovementMethod(new ScrollingMovementMethod());
tv.setVerticalScrollBarEnabled(true);
tv.setTextSize(14);
tv.setMaxHeight((int) (250 * density));
dialog.setView(tv, (int) (25 * density), (int) (15 * density), (int) (25 * density), 0);
DialogInterface.OnClickListener listener = new OnPromptClick(agent, true);
if (info.isForce) {
tv.setText("您需要更新應用才能繼續使用\n\n" + content);
dialog.setButton(DialogInterface.BUTTON_POSITIVE, "確定", listener);
} else {
tv.setText(content);
dialog.setButton(DialogInterface.BUTTON_POSITIVE, "立即更新", listener);
dialog.setButton(DialogInterface.BUTTON_NEGATIVE, "以後再說", listener);
if (info.isIgnorable) {
dialog.setButton(DialogInterface.BUTTON_NEUTRAL, "忽略該版", listener);
}
}
dialog.show();
}
示例2: prompt
import android.widget.TextView; //導入方法依賴的package包/類
@Override
public void prompt(IUpdateAgent agent) {
if (mContext instanceof Activity && ((Activity) mContext).isFinishing()) {
return;
}
final UpdateInfo info = agent.getInfo();
String size = Formatter.formatShortFileSize(mContext, info.size);
String content = String.format("最新版本:%1$s\n新版本大小:%2$s\n\n更新內容\n%3$s", info.versionName, size, info.updateContent);
final AlertDialog dialog = new AlertDialog.Builder(mContext).create();
dialog.setTitle("應用更新");
dialog.setCancelable(false);
dialog.setCanceledOnTouchOutside(false);
float density = mContext.getResources().getDisplayMetrics().density;
TextView tv = new TextView(mContext);
tv.setMovementMethod(new ScrollingMovementMethod());
tv.setVerticalScrollBarEnabled(true);
tv.setTextSize(14);
tv.setMaxHeight((int) (250 * density));
dialog.setView(tv, (int) (25 * density), (int) (15 * density), (int) (25 * density), 0);
DialogInterface.OnClickListener listener = new DefaultPromptClickListener(agent, true);
if (info.isForce) {
tv.setText("您需要更新應用才能繼續使用\n\n" + content);
dialog.setButton(DialogInterface.BUTTON_POSITIVE, "確定", listener);
} else {
tv.setText(content);
dialog.setButton(DialogInterface.BUTTON_POSITIVE, "立即更新", listener);
dialog.setButton(DialogInterface.BUTTON_NEGATIVE, "以後再說", listener);
if (info.isIgnorable) {
dialog.setButton(DialogInterface.BUTTON_NEUTRAL, "忽略該版", listener);
}
}
dialog.show();
}