我有更多的尺寸
<resources>
<dimen name="tag_text_size">10dp</dimen>
<dimen name="text_separator_size">15dp</dimen>
<dimen name="tag_text_count_size">8dp</dimen>
<dimen name="text_home_page_size">20dp</dimen>
<dimen name="item_text_head_size">15dp</dimen>
<dimen name="item_text_time_size">10dp</dimen>
<dimen name="item_text_price_size">14dp</dimen>
<dimen name="item_text_address_pattern_size">12dp</dimen>
<dimen name="item_text_address_size">14dp</dimen>
<dimen name="setting_text_head_size">24dp</dimen>
<dimen name="order_text_comment_size">11dp</dimen>
</resources>
Run Code Online (Sandbox Code Playgroud)
我在我的XML中使用这个维度..
<TextView
android:textSize="@dimen/item_text_head_size" />
Run Code Online (Sandbox Code Playgroud)
...
我想以编程方式更改维度,它将允许我在任何地方更改字符串的大小
怎么解决这个问题?
我生成一个0或1的随机数
int randomColor = (Math.random() < 0.5) ? 0 : 1;
我需要创建52个随机数,其中26个为0,26个为1
我使用这个来源:
String fulltext = "I would like to create a book reader have create, create ";
String subtext = "create";
int i = fulltext.indexOf(subtext);
Run Code Online (Sandbox Code Playgroud)
但我发现只有第一个索引,如何查找字符串中的所有第一个索引?(在这种情况下三个索引)
我的例子:
public static final String EXTRA_TARGET_FRAGMENT = "fragment_to_show";
public static void show(Activity pActivity,
Class<? extends Fragment> fragment) {
Intent intent = new Intent(pActivity, HomeActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra(EXTRA_TARGET_FRAGMENT, fragment);
pActivity.startActivity(intent);
}
@SuppressWarnings("unchecked")
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
mUpcomingTarget = (Class<Fragment>) intent
.getSerializableExtra(EXTRA_TARGET_FRAGMENT);
}
Run Code Online (Sandbox Code Playgroud)
mUpcomingTarget --> null,我不明白问题是什么。
我有字符串 String fulltext = "I would like to create some text and i dont know what creater34r3, ";
我有子串 String subtext = "create s";或"create som"或"create so"..
如何获得整个单词subtext?(在这种情况下"创建一些"或"创建")
Pattern.compile("\\b(" + subtext + "\\p{Alnum}+)"); - 不工作=(
我的消息来源
private static final int ALERT_DIALOG = 1;
@Override
public void onBackPressed() {
// buildAlertMessageExit();
showDialog(ALERT_DIALOG);
}
@Override
protected Dialog onCreateDialog(int id) {
Dialog dialog = null;
if (id == ALERT_DIALOG) {
ContextThemeWrapper ctw = new ContextThemeWrapper(this,
R.style.AlertDialogCustom);
AlertDialog.Builder builder = new AlertDialog.Builder(ctw);
builder.setMessage("Hello World")
.setTitle("Alert Dialog")
.setIcon(android.R.drawable.ic_dialog_alert)
.setCancelable(false)
.setPositiveButton("Close",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int which) {
dialog.dismiss();
}
});
dialog = builder.create();
}
if (dialog == null) {
dialog = super.onCreateDialog(id);
}
return dialog;
}
Run Code Online (Sandbox Code Playgroud)
样式文件 …
我的来源
Matcher matcher = Pattern.compile("[0-9]").matcher("35423523");
matcher.matches() - 现在是假的
但我需要matcher.matches() - true- 因为字符串是所有数字
或者例如
Pattern.compile("[0-9A-Za-z]").matcher("35dwedwfeASADdfd423523"); - 一定是真的
或Pattern.compile("[0-9]").matcher("354ccwq23523");- 必须是假的或Pattern.compile("[0-9a-z]").matcher("354ccwq23523");- 必须是真的
怎么做 ?
我正在做请求,它写了一个错误ID - INTEGER PRIMARY KEY帮助
cur = db.query("Sales_region_table t1, region_table t2 join region_table t2 on t1.id_region = t2.id ", null, " id_region = " + id_region + " and id_category = " + id_category + " and id_product = " + id_product + " ", null, null, null, null);
Run Code Online (Sandbox Code Playgroud)
11-01 08:28:10.600:I/Database(1251):sqlite返回:错误代码= 1,msg =不明确的列名:t2.id
我有 String cat = "cat1, cat1, cat1, cat1, cat2, cat2, cat2, cat3";
我需要 String cat = "cat1, cat2, cat3";
这该怎么做 ?
这是我的解决方案,但不是很好:
String[] words = cat.split(",");
Arrays.sort(words);
....
Run Code Online (Sandbox Code Playgroud)