我想使用ScaleAnimation(以编程方式不在xml中)更改高度以查看父高度的0到60%.视图宽度恒定,为50px.视图为空,仅设置背景颜色.
有人可以给我代码scaleAnim从代码中使用ScaleAnimation.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/layContainer
>
<View
android:layout_width="50px"
android:layout_height="fill_parent"
android:id="@+id/viewContainer"
android:background:"#00f00"
/>
</LinearLayout>
ScaleAnimation scaleAnim = new ScaleAnimation(...);
Run Code Online (Sandbox Code Playgroud)

在动画之前和之后查看.谢谢
如何在此之前的一周内以这种格式在android中获取日期:
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Run Code Online (Sandbox Code Playgroud)
前:现在2010-09-19 HH:mm:ss,一周之前2010-09-12 HH:mm:ss
谢谢
我想知道何时在我的类中使用get和set方法(getName,setName),classVariable.name = ""而不是简单? = classVariable.getName()
这是使用set和get方法的类的示例
public class ClassExampe {
String name;
String course;
public String getName ( )
{
return name;
}
public void setName (String studentName)
{
name = studentName;
}
public String getCourse ( )
{
return course;
}
public void setCourse (String studentCourse)
{
course = studentCourse;
}
}
Run Code Online (Sandbox Code Playgroud)
谢谢
在我的Android应用程序中,我使用AsynTask with Progress Dialog(请等待登录...)用于使用我的网页登录用户(AsynTask内的Web服务功能)
我想在用户点击设备上的后退按钮时解除进度对话框并取消AsynTask.
我无法找到那种中断AsynTask的例子.我读了abouth cancel(boolean)但我不知道如何从UI调用.
任何人都可以给我一些想法
谢谢
在onLocationChanged事件中,我想保存我的GPS路线(纬度,经度).后来我想加载这些数据并绘制路线.
通过使用某种数组类型(并使用数据库保存或加载)或XML文件或其他内容,谁是最好的方法?
谢谢.
我想startForeground()在Service类中实现该方法以防止服务自杀.
任何人都可以给我发送实现此方法的代码吗?
从我的Android应用程序中,我想要一个带有GET参数的URL并阅读响应.在请求中我必须添加x-zip标头.
URL就像
http://example.com/getmethod.aspx?id=111&method=Test
Run Code Online (Sandbox Code Playgroud)
有人可以为我提供代码吗?
有两件事很重要:它是一个GET请求并包含x-zip标题.
编辑:
try {
HttpClient client = new DefaultHttpClient();
String getURL = "http://example.com/getmethod.aspx?id=111&method=Test";
HttpGet get = new HttpGet(getURL);
get.setHeader("Content-Type", "application/x-zip");
HttpResponse responseGet = client.execute(get);
HttpEntity resEntityGet = responseGet.getEntity();
if (resEntityGet != null) {
//do something with the response
Log.i("GET ",EntityUtils.toString(resEntityGet));
}
} catch (Exception e) {
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
我尝试使用此代码,但我得到.net错误的代码:Object reference not set to an instance of an object...
我想但我不确定这是否为x-zip标题,我的代码中的标题好吗?
代码...... {
private void createRadioButton() {
final RadioButton[] rb = new RadioButton[5];
for(int i=0; i<5; i++){
rb[i] = new RadioButton(this);
ll.addView(rb[i]);
rb[i].setText("Test");
}
ll.addView(submit);
submit.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
for(int i = 0; i < 5; i++) {
ll.removeView(rb[i]);
}
ll.removeView(submit);
Questions();
}});
}
Run Code Online (Sandbox Code Playgroud)
我遇到的问题是出现单选按钮,用户可以选择任何一个.作为初学者,我确定我没有正确设置单选按钮.用户可以选择所有五个按钮,然后一旦选择,他们也无法取消选中它们.用户应该只能从五个中选择一个选项......我怎样才能做到这一点?
有人可以告诉我何时使用Overlay或何时使用ItemizedOverlay类!
这两个班级有什么区别?
绘制方法做同样的事情?
我可以在项目中仅使用ItemizedOverlay类,或者必须使用Overlay作为基类!
谢谢
我想创建Service using bindService 方法.但是,当我关闭一个Activity时,我的服务被销毁了,我不希望这样.
我尝试使用startForeground(NOTIFICATION_ID, notification);服务onCreate 将服务放在前台 ,但服务仍然会破坏.
现在我尝试使用call两个方法同时启动Service:
Intent bindIntent= new Intent(this, ServiceC.class);
startService(bindIntent);
bindService(bindIntent, onService, BIND_AUTO_CREATE);
Run Code Online (Sandbox Code Playgroud)
通过调用这两个方法Service不会被破坏.我的应用程序正常使用此方法.
有人可以向我解释这是否是一个好方法,或者如果不是,请你能否解释为什么startForeground(NOTIFICATION_ID, notification);不起作用?
使用bindService的最佳方法是什么,但同时我不希望服务自行销毁.