내 XML에서이 작업을 수행하려고합니다. 현재 내가이 일을 해요 : 나는 단지 @drawable/logo
의 일부를 얻을가로 세로 비율을 그대로 유지하면서 모든 화면에 맞도록 다른 요소간에 이미지 배치
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
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="com.example.MainActivity">
<ImageView
android:id="@+id/main_drawable_text"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@drawable/text" />
<LinearLayout
android:id="@+id/main_drawable_logo"
android:layout_width="match_parent"
android:layout_below="@id/main_drawable_text"
android:layout_height="wrap_content">
<ImageView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.1"
android:layout_centerHorizontal="true"
android:adjustViewBounds="true"
android:src="@drawable/logo" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_below="@id/main_drawable_logo"
android:layout_height="wrap_content">
<TextView
android:id="@+id/credits"
android:layout_width="wrap_content"
android:layout_centerHorizontal="true"
android:layout_height="wrap_content"
android:text="@string/credits" />
</LinearLayout>
</RelativeLayout>
을 내 테스트 장치에서, 나머지는 신용의 텍스트처럼 화면에서 떨어진다. 원하는 결과가 나올 때까지 무게를 조정할 수는 있지만 모든 장치에서 예상되는 결과를 얻으려면 어떻게해야합니까?
내가 원하는 main_drawable_text
항상 화면 drawable_logo
의 바닥에있는 항상 credits
, (마진 마진에서) 화면의 폭을 일치 그들 사이의 여유 공간에 맞게 크기가 조정되어, 아직 원래의 화면 비율입니다 .