设置Android的ZoomButtonsController对齐? [英] set Android ZoomButtonsController alignment?
问题描述
林在我的自定义视图实现ZoomButtonsController并一直在试图找出如何将其调整到屏幕的右下角(它对齐的底部中间默认情况下),但还没有任何运气。
Im implementing a ZoomButtonsController in my custom View and have been trying to figure out how to align it to the bottom right hand corner of the screen (it aligns to the bottom middle by default) but havent had any luck.
推荐答案
ZoomButtonsController可以在XML文件中定义,并且可以相应地定位,为例如
ZoomButtonsController can be defined in XML files and can be positioned accordingly , for eg.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ZoomControls android:id="@+id/zoomControls1"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true">
</ZoomControls>
</RelativeLayout>
由属性定义的这种布局将在屏幕的右上方你zoomcontrols,
This layout will make your zoomcontrols in top-right of the screen as defined by the attributes ,
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
所以基本上可以通过它们嵌套在布局调整的意见(如RelativeLayout的,LinearLayout中等等。)
so basically you can align your views by nesting them in a Layout (like RelativeLayout , LinearLayout etc.)
这篇关于设置Android的ZoomButtonsController对齐?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!