布局问题 我用xml来布局的应该可以实现的 但动态生成按钮 不知道怎么做?
解决方案 »
- downloadmanager的问题
- 多个activity的应用,按home后,再进程序,如果保持之前的状态?急
- 关于Box2D在Android项目中的问题
- android .txt文件的读取编码格式问题
- phonegap2.0上传图片问题
- 如何通过安卓的logcat查询短信行为的记录
- Android用串口编写RS485的简单轮询,从机应答有时出现大量的3F 3F,是否总线冲突,还是其他原因
- 怎么捕抓一个应用被用户关闭的事件?
- android关于listview更新数据后如何保持位置不变
- Android一改主题就报错
- 在用ScrollView嵌套了listView或者GridView后滚动条没显示了
- android 文字合成声音
RelativeLayout rootLayout = (RelativeLayout)findViewById(R.id.rootLayout);
Button btnOK = new Button(this);
btnOK.setText("OK");
rootLayout.addView(btnOK);
layout文件:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rootLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" > <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" /></RelativeLayout>