好吧,我已经定义喜欢我的main.xml:Android:你可以在代码中编辑用xml创建的视图吗?
<LinearLayout android:id="@+id/linearLayout1" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android">
<EditText android:text="EditText" android:id="@+id/editText1" android:layout_width="match_parent" android:layout_height="175px"></EditText>
<LinearLayout android:layout_height="wrap_content" android:id="@+id/linearLayout2" android:layout_width="match_parent" android:layout_marginLeft="100px">
<Button android:id="@+id/button1" android:layout_height="wrap_content" android:layout_weight="1" android:layout_width="wrap_content" android:text="@string/btnPrint"></Button>
<Button android:id="@+id/button2" android:layout_height="wrap_content" android:layout_weight="1" android:layout_width="wrap_content" android:text="@string/btnCancel"></Button>
</LinearLayout>
</LinearLayout>
我希望能够调用之前更新从代码的EditText的光标位置setContentView(R.layout.main)
,这可能吗?如果不是,那么用于设置EditText View的光标位置的xml属性是什么?
感谢,
贾斯汀
我想这样做,我应该这样做,我应该大声笑。我只是新的这个android编程的东西。不习惯整个XML UI编程的东西。 – Justin 2011-03-17 14:49:53
我认为这对你而言会很好。 – FoamyGuy 2011-03-17 14:50:45
我还有一个问题,不妨在这里问一下。我正在通过手机调试我的程序。现在,我更改了main.xml,但是当程序加载到手机上时,它仍然显示最初在helloworld示例中的布局。 – Justin 2011-03-17 15:03:26