我试着这样做
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
t=new TextView(this);
t=(TextView)findViewById(R.id.TextView01);
t.setText("Step One: blast egg");
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
t.setText("Step Two: fry egg");
Run Code Online (Sandbox Code Playgroud)
但出于某种原因,我运行时只显示第二个文本.我认为它可能与Thread.sleep()方法阻塞有关.那么有人能告诉我如何"异步"实现定时器吗?
谢谢.
好,
我想要做的是在默认布局main.xml中嵌入自定义视图:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.lam.customview.CustomDisplayView
android:id="@+id/custom_display_view1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/prev"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="50"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="@string/prev" />
</LinearLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
如您所见,该类名为com.lam.customview.CustomDisplayView,其id为custom_display_view1.
现在在com.lam.customview.CustomDisplayView类中,我想使用另一个名为custom_display_view.xml的布局,因为我不想以编程方式创建控件/窗口小部件.
custom_display_view.xml只是一个按钮和一个图像,我想根据特定条件更改其内容:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="@+id/display_text_view1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
<ImageView
android:id="@+id/display_image_view1"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</ImageView>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
我试着这样做:
1)
public CustomDisplayView(Context context, AttributeSet attrs) {
super(context, attrs);
try
{
// register our interest in hearing about changes to our surface
SurfaceHolder holder = getHolder(); …Run Code Online (Sandbox Code Playgroud) 是否可以通过命令行运行FileZilla客户端,并能够设置服务器名称,用户,密码,FTP协议(例如FTPES,SFTP),端口号?我在网上看,似乎无法找到任何这样的命令.另外,我正在使用Windows 7,我不确定这是否有一个较小的命令集.谢谢.
我试图通过sftp协议将文件ftp到客户端:
curl -u username --key C:\cygwin\home\XJ0002T\.ssh\id_rsa --pubkey c:\cygwin\home\XJ0002T\.ssh\id_rsa.pub -
T c:\temp2\test4.txt sftp://server/SFTP/ --insecure
Run Code Online (Sandbox Code Playgroud)
输入用户的主机密码XJ0002T:
Curl一直在问我密码.我尝试过使用OpenSSH和puttyGen的密钥对,但都没有用.有人能告诉我我做错了什么吗?