其他分享
首页 > 其他分享> > 设置Android ZoomButtonsController对齐?

设置Android ZoomButtonsController对齐?

作者:互联网

我在我的自定义视图中实现了ZoomButtonsController并且一直在试图弄清楚如何将它对齐到屏幕的右下角(默认情况下它与底部中间对齐)但没有任何运气.

解决方法:

ZoomButtonsController可以在XML文件中定义,并且可以相应地定位,例如.

<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>

此布局将使您的缩放控件位于屏幕的右上角,由属性定义,

android:layout_alignParentTop="true"
android:layout_alignParentRight="true"

所以基本上你可以通过将它们嵌套在布局中来对齐你的视图(比如RelativeLayout,LinearLayout等)

标签:zooming,android,android-layout
来源: https://codeday.me/bug/20191003/1846882.html