我有一个edittext和一个微调器.当我触摸编辑文本键盘出现时,在完成文本编辑后,我触摸微调器的下拉箭头但键盘不会自动消失.请给我一些解决方案.我试过这段代码
InputMethodManager imm=(InputMethodManager)getApplicationContext().getSystemService(SetUpProfileActivity.this.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(mDateOfBirth.getWindowToken(), 0);
Run Code Online (Sandbox Code Playgroud)
这是xml
<LinearLayout
android:id="@+id/outerlayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp"
>
<TextView
android:id="@+id/name_view"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/profile_name"
android:textColor="#ffffff" />
<EditText
android:id="@+id/profile_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="@drawable/txtbox"
android:singleLine="true" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="@string/dateofbirth"
android:textColor="#ffffff" />
<Spinner
android:id="@+id/dob"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="@drawable/dropdown" />
Run Code Online (Sandbox Code Playgroud) 我有一个listview,其中我在固定间隔后添加一些数据.但我不想再次设置适配器,因为它将刷新完整列表.是否有任何方法添加项目而不刷新完整列表.
提前致谢.
我正在尝试自定义图例,但无法这样做。我的目的是提供不同的图例标签。我使用 MPChart 库来做到这一点。
ArrayList<BarEntry> entries = new ArrayList<>();
entries.add(new BarEntry(4f, 0));
entries.add(new BarEntry(8f, 1));
entries.add(new BarEntry(6f, 2));
entries.add(new BarEntry(12f, 3));
entries.add(new BarEntry(18f, 4));
mColors.add(R.color.red);
mColors.add(R.color.text_color_gray);
mColors.add(R.color.text_color_blue);
mColors.add(R.color.green);
mColors.add(R.color.black);
BarDataSet dataset = new BarDataSet(entries, null);
ArrayList<String> labels = new ArrayList<String>();
labels.add("05");
labels.add("06");
labels.add("07");
labels.add("08");
labels.add("09");
BarData data = new BarData(labels, dataset);
Legend legend = mChart.getLegend();
legend.setEnabled(true);
legend.setPosition(Legend.LegendPosition.BELOW_CHART_CENTER);
legend.setForm(Legend.LegendForm.SQUARE);
legend.setColors(mColors);
legend.setLabels(mLabels);
mChart.setData(data);
mChart.animateY(2000);
LimitLine line = new LimitLine(10f);
YAxis yAxis = mChart.getAxisLeft();
yAxis.addLimitLine(line);
yAxis.setDrawAxisLine(true);
mChart.setDrawValueAboveBar(true);
mChart.setDrawBarShadow(false);
mChart.setVisibleXRange(4);
mChart.moveViewToX(2);
mChart.setDrawValueAboveBar(false);
mChart.invalidate();
Run Code Online (Sandbox Code Playgroud)
请让我知道任何解决方案。
我正在使用MPAndroidChart,我想在条形图的中心设置条形图值并使用更大的字体.
mChart.setDrawValueAboveBar(false);
Run Code Online (Sandbox Code Playgroud)
通过使用上面的值显示在栏内但不在中心.我正在使用MpChart提前感谢
我想要一个只接受字母、连字符、撇号、下划线的正则表达式。我试过
/^[ A-Za-z-_']*$/
Run Code Online (Sandbox Code Playgroud)
但它不工作。请帮忙。
我试图理解 SingleTask 和 FLAG_ACTIVITY_CLEAR_TOP 之间的区别。似乎两者都以相同的方式工作。例如,我创建了 Activity A -> B -> c -> D -> E,其中 C 的启动模式是 SingleTask。现在,如果我从 E 打开 C,然后按回键,我会得到 A -> B -> c 当我使用 FLAG_ACTIVITY_CLEAR_TOP 从 E 启动 C 时,会发生同样的情况。不确定这两者之间有什么区别。
我想要一个我想在其中执行搜索的项目列表。我希望以区分大小写的顺序根据查询过滤项目。例如,如果用户搜索牛奶,订单应该是牛奶牛奶黄油牛奶黄油牛奶下面是我当前的查询,但由于我添加了 Case.Insesitive,它根据表中项目的位置给我任何随机顺序。
mRealm.where(Product.class).contains("productTags.name", tag,Case.INSENSITIVE).findAll();
Run Code Online (Sandbox Code Playgroud)