好日子伙计们.
我在操作栏中有一个搜索图标,如下图所示
单击它时,我希望操作栏更改为editText并icon在旁边进行搜索editText
我知道如何使用图像制作editText,但是如何将editText放在动作栏上,如下图所示?并且我想在editText填充值后创建数据显示值.我应该使用意图吗?
这是我到目前为止所尝试的.
活动A.
getData(deviceName, month); // retrieve data from `MySQL` and load into listView
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.create_menu, menu);
return true;
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
mSearchAction = menu.findItem(R.id.search);
return super.onPrepareOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar …Run Code Online (Sandbox Code Playgroud) 在我们的应用程序中,我们希望使用Spring和JPA设置多个数据源.因此我们创建了2个entityManagerFactory,2个数据源和2个事务管理器.
web.xml中
<param-value>
/WEB-INF/a_spring.xml
/WEB-INF/b_spring.xml
</param-value>
Run Code Online (Sandbox Code Playgroud)
persistence.xml中
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="db1" transaction-type="RESOURCE_LOCAL">
<class>com.rh.domain.RcA</class>
</persistence-unit>
<persistence-unit name="db2" transaction-type="RESOURCE_LOCAL">
<class>com.rh.domain.Rcb</class>
</persistence-unit>
</persistence>
Run Code Online (Sandbox Code Playgroud)
a_spring.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>
<bean id = "RcMaintenanceService" class="com.rh.services.RcAbcMaintenanceServiceImpl" autowire="byName" />
<aop:config>
<aop:pointcut id="rOperation" expression="execution(* com.rh.services.*.*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="rOperation"/>
</aop:config>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="*"/>
</tx:attributes>
</tx:advice>
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/db1" />
</bean>
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property …Run Code Online (Sandbox Code Playgroud) 今天当我使用android studio进行项目时,突然出现蓝屏,系统自动重启.现在当我尝试使用模拟器运行我的应用程序时,AVD没有运行,我收到如下错误.以前有人面对这个吗?我该如何解决?
ProcessNotCreatedException:启动AVD时出现意外错误:无法运行程序"C:\ Users\tongws\AppData\Local\Android\sdk\tools\emulator.exe":CreateProcess error = 216,此版本的%1与版本不兼容您正在运行的Windows.检查计算机的系统信息,以查看是否需要x86(32位)或x64(64位)版本的程序,然后与软件发行商联系
我点击Android设备监视器,也没有发生任何事情......
在DeleteTask中,如果在listView中选中了复选框,我有一个用于删除列表的按钮.
delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
int itemCount = listview.getCount();
for (int i = itemCount - 1; i >= 0; i--) {
SearchList search = adapter.getItem(i);
if (search.isSelected()) {
adapter.removeItem(i);
delete.setText("DELETE");
counter=0;
}
}
}
});
Run Code Online (Sandbox Code Playgroud)
在DeleteAdapter中,它有一个计数器,用于计算复选框并显示计数器button.button单击删除后,计数器将重置为0并仅DELETE在删除buttonsetText中显示.
holder.ckbox.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (((CheckBox) v).isChecked()) {
int getPosition = (Integer) v.getTag(); // Here we get the position that we have …Run Code Online (Sandbox Code Playgroud) 是否可以通过滑动将数据从片段传递到片段?
有许多文章教我们如何将数据从片段传递到片段,但大多数文章或问题都在其第一个片段中实现了OnClickListener,用于将值传递给另一个片段.
但我的情况是从两个片段传递数据而没有任何按钮点击,最后通过单击最后一个片段中的按钮将它们保存在不同的表中.我能做些什么来实现这个目标?
流程为 Information>> WorkForce>> WorkDetailsTable并通过单击按钮将它们保存到不同的表中.
我试图解决它,但我在SQLite中得到NULL值.我想我错过了很多,但不知道.请帮助我...我已经被困在这里超过两天了......谢谢
Tab.java
public class Tab extends ActionBarActivity implements ActionBar.TabListener {
ViewPager Tab;
TabPagerAdapter TabAdapter;
ActionBar actionBar;
public static String name = null;
public static String subContractors = null;
// will be used for data communication
public static Force force_bean;;
public static Info info_bean;
public static Force getForce(){
return force_bean;
}
public static void setForce(Force force){
force_bean=force;
}
public static Info getInfo(){
return info_bean;
}
public static void setInfo(Info info){
info_bean=info; …Run Code Online (Sandbox Code Playgroud) 我已经在我的颤振项目中实现了signature_pad并且它工作正常。
不幸的是,当我把它放在里面时SingleChildScrollView,签名没有画出来。它滚动而不是签名。
似乎是,GestureDetector但我不知道如何解决它。
有人可以给我一些线索吗?
谢谢。
我想知道如何实现这个目标?
我在操作栏中有一个搜索图标,如下图所示
单击它时,我希望操作栏更改为editText并icon在旁边进行搜索editText
我知道如何使用图像制作editText,但是如何将editText放在动作栏上,如下图所示?
在我的应用程序中,它有两个选项卡,一个是Reminder,另一个是Completed Task.
单击切换按钮时,我希望将列表移动到已完成的任务.
这个想法是:
但是当我点击切换按钮并滑动到已完成时,它仍然是空的.退出应用程序后,然后滑动到选项卡,只显示数据.
如何滑动而不是退出应用并再次重新打开时,如何立即将数据显示在"已完成"选项卡中?谢谢
AllAdapter(提醒)
holder.toggle.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (((ToggleButton)v).isChecked()) {
int getPosition = (Integer) v.getTag(); // Here we get the position that we have set for the checkbox using setTag.
search.get(getPosition).setSelected(((ToggleButton) v).isChecked());
int id= search.get(getPosition).getID();
mdb = new MyDatabaseHelper(v.getContext());
database = mdb.getReadableDatabase();
Cursor cursor = database.rawQuery("SELECT * FROM " + MyDatabaseHelper.TABLE__TASK + " WHERE ID = ? ", new String[]{id+""}, null);
if (cursor != null && …Run Code Online (Sandbox Code Playgroud) 我已经editText点击了.单击后,将显示DatePicker dialog.
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.information);
date = (EditText) findViewById(R.id.date);
dialog=new DateDialog();
date.setOnClickListener(this);
public void onClick(View arg0) {
FragmentTransaction ft = getFragmentManager().beginTransaction();
dialog.show(ft, "DatePicker");
}
public static class DateDialog extends android.app.DialogFragment implements DatePickerDialog.OnDateSetListener {
public DateDialog() {}
public Dialog onCreateDialog(Bundle savedInstanceState)
{
final Calendar c=Calendar.getInstance();
int year=c.get(Calendar.YEAR);
int month=c.get(Calendar.MONTH);
int day=c.get(Calendar.DAY_OF_MONTH);
return new DatePickerDialog(getActivity(),this,year,month,day);
}
public void onDateSet(DatePicker view,int year, int month, int day)
{
String date1=day+"-"+(month+1)+"-"+year;
date.setText(date1);
date2= date.getText().toString();
return ;
} …Run Code Online (Sandbox Code Playgroud)