1. 占位富大家都很熟悉,但是在android中没有提供,可是有时候我们想一个部分空着 但是又不让被发现
那么就使用
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/login_EditText_password"
android:orientation="horizontal">
<View
android:layout_width="0dip"
android:layout_height="0dip"
android:layout_weight="1" />
<Button
android:text="@string/login_login"
android:id="@+id/login_Button_login"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
view就是用来占位的啊。
2. 因为不能从快捷键启动服务 只能间接实行
public class MyServiceActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = new Intent(this, MyService.class);
startService(intent);
finish();
}
}
也就是说启动一个activity然后在里面启动服务
本文介绍Android应用开发中的两个实用技巧:一是如何利用View进行界面布局的占位操作而不影响美观;二是如何通过间接方式启动服务,即通过启动一个Activity并在其中启动服务。
5092

被折叠的 条评论
为什么被折叠?



