我们正在为开发Android应用程序的单个应用程序创建许多XML文件; 当然这是android的主题.对于app的每个屏幕,我们都在创建一个带有一些布局的XML(静态实现).在执行时,每次读取XML文件以获取它想要显示我们设计的屏幕的所有资源.
通过在java代码本身中添加几行(动态实现)可以实现相同的设计.就像我们可以扩展ListActivity而不是创建XML文件一样.那么为什么要使用XML,因为应用程序需要从手机内存中读取文件,这可能导致访问速度慢并使应用程序变慢?
因此,动态实现总是优于静态实现.
如果我错了,请纠正我.
嗨,我正在开发一个创建动态组件,如按钮等的应用程序.当某种情况发生时,我想删除或清空我的布局..任何人都可以指导或建议我吗?
我试图在我的应用程序中使用.NET Web服务,其中服务返回一个对象数组作为响应.
这是来自Web服务的响应格式.
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetPickersResponse xmlns="http://tempuri.org/">
<GetPickersResult>
<Picker>
<Id>int</Id>
<StartTime>dateTime</StartTime>
<EndTime>dateTime</EndTime>
<PickerCount>int</PickerCount>
</Picker>
<Picker>
<Id>int</Id>
<StartTime>dateTime</StartTime>
<EndTime>dateTime</EndTime>
<PickerCount>int</PickerCount>
</Picker>
</GetPickersResult>
</GetPickersResponse>
</soap:Body>
</soap:Envelope>
Run Code Online (Sandbox Code Playgroud)
这是我的Java代码,用于从Web服务获取响应.
SoapObject request = new SoapObject(NAMESPACE, METHOD_GET_CONTROL);
SoapSerializationEnvelope envelope =
new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try {
androidHttpTransport.call(SOAP_ACTION_GET_CONTROL, envelope);
..........=envelope.getResponse(); //To get the data. }
Run Code Online (Sandbox Code Playgroud)
我的问题是,我在源代码中替换"........"以接收来自服务的响应对象数组?我需要接收多个对象,然后使用他们各自的数据成员.
请帮忙.我是Web服务和Ksoap的新手.
我希望我的应用程序中的EditText在应用程序启动时默认使用光标.我试过用
<EditText
android:id="@+id/idInput"
android:layout_width="480dp"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:ems="10" >
<requestFocus />
</EditText>
Run Code Online (Sandbox Code Playgroud)
并且
userIdInput = (EditText)findViewById(R.id.idInput);
userIdInput.setFocusable(true);
userIdInput.setFocusableInTouchMode(true);
userIdInput.requestFocus();
Run Code Online (Sandbox Code Playgroud)
但似乎没有任何效果.当应用程序启动时,光标无处可见,我必须手动单击EditText以使光标出现在其上.
哪里可能出错?
顺便说一句,我正在开发Android 4.0.3平板电脑.
在我的应用程序中,我试图在用户单击按钮时显示数字小键盘.
单击该按钮时,我使用requestFocus()将焦点移动到布局中的EditText,然后我需要显示数字小键盘,以便用户可以键入值.
值始终为数字,因此我只需要显示数字键盘.
我厌倦了在我的按钮的onClick()方法中使用它,但它不起作用.
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);
Run Code Online (Sandbox Code Playgroud)
请为我提供任何解决方案.
此外,我的应用程序是支持4.0.3的Android平板电脑.
我想让我的应用扫描用户联系人列表,并显示同时安装该应用的联系人姓名.
我不知道从哪里开始.所以,如果有人可以帮助我开始,那将是一个折旧的.
grtz
有一些MVC应用程序的代码是使用.NET 4.5作为VS 2012中的框架构建的.我当前的系统迫使我在VS 2010上工作.我设法在我的VS2010中打开VS2012解决方案,但问题是VS2010仅支持.NET 4.
例如,代码中有一些函数使用dll文件,这些函数仅适用于.NET 4.5 System.ComponentModel.DataAnnotations.Schema.
那么,.NET 4中是否有可用的替代函数/属性,我现在可以使用它来完成与.NET 4.5相同的操作?
这是我使用.NET 4.5的当前代码:
[Table("UserProfile")]
public class UserProfile
{
[Key]
[DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
public int UserId { get; set; }
public string UserName { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
如您所见DatabaseGeneratedAttribute,System.ComponentModel.DataAnnotations.Schema命名空间下可用,它是.NET 4.5的一部分.
有关.NET 4中可用于表示相同逻辑的相应功能/属性的建议吗?
注意:在上面给出的代码段中,我得到错误Table和DatabaseGeneratedAttributeas
找不到类型或命名空间名称"Table"(您是否缺少using指令或程序集引用?)
和
找不到类型或命名空间名称"DatabaseGeneratedAttributeAttribute"(您是否缺少using指令或程序集引用?)
分别.所以,我猜我只需要在.NET 4.0中找到相应的类,事情就会到位.非常感谢您的帮助.
有人知道如何深入链接到Facebook iOS应用程序吗?
我用Google搜索并找到了以下解决方案:
...但他们都没有工作,无论是在Facebook iOS 6应用程序上,还是在Facebook iOS 7应用程序上.
我找到的唯一解决方案是链接到:http://m.facebook.com/PAGENAME.这可以通过打开Safari来实现,但由于用户未必登录,因此体验非常糟糕.
谢谢,
我想在手机启动时自动启动我的应用程序。我在清单文件中声明了BroadcastReceiver。
<receiver android:name=".Autostart">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
Run Code Online (Sandbox Code Playgroud)
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
Run Code Online (Sandbox Code Playgroud)
我为接收器制作了一个Java文件。
自动启动
public class Autostart extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if ("android.intent.action.BOOT_COMPLETED".equals(intent.getAction())) {
Intent pushIntent = new Intent(context, MushTouchActivity.class);
pushIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(pushIntent);
}
}
Run Code Online (Sandbox Code Playgroud)
}
但是,当我打开手机电源时,该应用程序无法启动。谁能告诉我我在这里想念的吗?
我想更改在ExpandableListView中单击的子项的背景颜色.也就是说,当点击任何孩子时,它的背景颜色应该被改变.我试图以这种方式去它,但它选择了一些其他行,而不是已被点击的那一行.
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
parent.getChildAt(childPosition).setBackgroundColor(Color.DKGRAY);
return false;
}
Run Code Online (Sandbox Code Playgroud)
请告诉我可能缺少的东西.
android ×8
.net-4.0 ×1
.net-4.5 ×1
android-xml ×1
arrays ×1
asp.net ×1
asp.net-mvc ×1
boot ×1
buttonclick ×1
c# ×1
facebook ×1
focus ×1
ios ×1
startup ×1
web-services ×1
xml ×1