tre*_*tas 9 layout android center view
我试图使用布局和重力属性将视图置于不同分辨率的中心,但它不起作用.有没有办法使自定义视图中心水平跨越不同的分辨率?
我需要在onMeasure方法上做点什么吗?
这是我现在正在尝试的事情之一,视图位于中心的左侧..
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="50dp"
android:gravity="center_horizontal">
<com.application.app.ui.CustomView
android:id="@+id/ivCoinAnimation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"/>
</RelativeLayout>
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4253 次 |
| 最近记录: |