设置Activity的显示位置
2015-09-11 08:30
417 查看
Activity大家都很熟悉了,窗口形式的activity最近稍微研究了一下,突然想到,如何让activity显示在自己想要的地方,经过朋友的帮助,得到了初步解决,现分享给大家。
[xhtml] view
plaincopy
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".Test1"
android:label="@string/app_name"
android:theme="@android:style/Theme.Panel"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
[java] view
plaincopy
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
WindowManager.LayoutParams lp = getWindow().getAttributes();
lp.width = LayoutParams.FILL_PARENT;
lp.gravity = Gravity.BOTTOM;
getWindow().setAttributes(lp);
}
这样activity就在屏幕的底端显示了。
地址:http://blog.csdn.net/fengqiaoyebo2008/article/details/5907373
[xhtml] view
plaincopy
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".Test1"
android:label="@string/app_name"
android:theme="@android:style/Theme.Panel"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
[java] view
plaincopy
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
WindowManager.LayoutParams lp = getWindow().getAttributes();
lp.width = LayoutParams.FILL_PARENT;
lp.gravity = Gravity.BOTTOM;
getWindow().setAttributes(lp);
}
这样activity就在屏幕的底端显示了。
地址:http://blog.csdn.net/fengqiaoyebo2008/article/details/5907373
相关文章推荐
- DWZ刷新dialog解决方法
- MC Dialog js弹出层 完美兼容多浏览器(5.6更新)
- js Dialog 去掉右上角的X关闭功能
- jquery BS,dialog控件自适应大小
- jquery ui dialog实现弹窗特效的思路及代码
- JQUERY dialog的用法详细解析
- jQuery实现dialog设置focus焦点的方法
- Locate a File Using a File Open Dialog Box
- Save a File Using a File Save Dialog Box
- Android中自定义对话框(Dialog)的实例代码
- JQuery Dialog(JS 模态窗口,可拖拽的DIV)
- Jquery中dialog属性小记
- jQuery Dialog 弹出层对话框插件
- jquery dialog open后,服务器端控件失效的快速解决方法
- android自由改变Dialog窗口位置的方法
- 探讨:你真的会用Android的Dialog吗?
- Android 去掉自定义dialog的白色边框的简单方法
- Android解决dialog弹出时无法捕捉Activity的back事件的方法
- Android中Dialog去黑边的方法
- Android Dialog 设置字体大小的具体方法