ssomai / ScalableLayout

Scalable Layout For Android
Apache License 2.0
270 stars 87 forks source link

빈공간에 대해 질문드립니다.. #57

Open joodragon92 opened 6 years ago

joodragon92 commented 6 years ago

안녕하세요 해상도대응 때문에 찾아보다가 우연히 ScalableLayout을 찾아서 적용을 한상태입니다.

대응되는 폰마다 가로, 세로 비율 문제는 없었습니다. 그런데 하단부에 빈공간이 생기는 현상이 발생하게되었네요.. 해결하기 위해 https://github.com/ssomai/ScalableLayout/issues/30 위 링크에 있는 방법으로

  1. 루트레이아웃을 ScalableLayout이 아닌 레이아웃
  2. 화면 중앙 부분 빈 뷰 시도해봤지만 제어가 안되었습니다

아래는 현재 적용되어있는 레이아웃소스입니다 확인 부탁드립니다..

<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/swipe_refresh" android:layout_width="match_parent" android:layout_height="match_parent">

<LinearLayout
    android:id="@+id/linearlayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="center"
    android:background="@drawable/main_bg"
    android:orientation="vertical">

    <com.ssomai.android.scalablelayout.ScalableLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:scale_base_height="2110"
        app:scale_base_width="1320">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#33000000"
            app:scale_height="400"
            app:scale_left="0"
            app:scale_top="400"
            app:scale_width="1320"/>

        <TextView
            android:id="@+id/text_SH1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:textColor="#508ab9f2"
            app:scale_height="90"
            app:scale_left="20"
            app:scale_textsize="55"
            app:scale_top="10"
            app:scale_width="150" />

        <TextView
            android:id="@+id/text_SH2"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:textColor="#ffffff"
            app:scale_height="90"
            app:scale_left="160"
            app:scale_textsize="55"
            app:scale_top="10"
            app:scale_width="155" />

        <WebView
            android:id="@+id/webview2_2"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:scale_height="310"
            app:scale_left="20"
            app:scale_textsize="50"
            app:scale_top="80"
            app:scale_width="310" />

        <TextView
            android:id="@+id/text_HS1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:textColor="#508ab9f2"
            app:scale_height="90"
            app:scale_left="345"
            app:scale_textsize="55"
            app:scale_top="10"
            app:scale_width="150" />

        <TextView
            android:id="@+id/text_HS2"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:textColor="#ffffff"
            app:scale_height="90"
            app:scale_left="485"
            app:scale_textsize="55"
            app:scale_top="10"
            app:scale_width="155" />

        <WebView
            android:id="@+id/webview2_3"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:scale_height="310"
            app:scale_left="345"
            app:scale_textsize="50"
            app:scale_top="80"
            app:scale_width="310" />

        <TextView
            android:id="@+id/text_HS21"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:textColor="#508ab9f2"
            app:scale_height="90"
            app:scale_left="670"
            app:scale_textsize="55"
            app:scale_top="10"
            app:scale_width="150" />

        <TextView
            android:id="@+id/text_HS22"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:textColor="#ffffff"
            app:scale_height="90"
            app:scale_left="810"
            app:scale_textsize="55"
            app:scale_top="10"
            app:scale_width="155" />

        <WebView
            android:id="@+id/webview2_4"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:scale_height="310"
            app:scale_left="670"
            app:scale_textsize="50"
            app:scale_top="80"
            app:scale_width="310" />

        <TextView
            android:id="@+id/text_GJ1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:textColor="#508ab9f2"
            app:scale_height="90"
            app:scale_left="995"
            app:scale_textsize="55"
            app:scale_top="10"
            app:scale_width="150" />

        <TextView
            android:id="@+id/text_GJ2"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:textColor="#ffffff"
            app:scale_height="90"
            app:scale_left="1135"
            app:scale_textsize="55"
            app:scale_top="10"
            app:scale_width="155" />

        <WebView
            android:id="@+id/webview2_5"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:scale_height="310"
            app:scale_left="995"
            app:scale_textsize="50"
            app:scale_top="80"
            app:scale_width="310" />

        <TextView
            android:id="@+id/text_KJ1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:textColor="#508ab9f2"
            app:scale_height="90"
            app:scale_left="20"
            app:scale_textsize="55"
            app:scale_top="400"
            app:scale_width="150" />

        <TextView
            android:id="@+id/text_KJ2"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:textColor="#ffffff"
            app:scale_height="90"
            app:scale_left="160"
            app:scale_textsize="55"
            app:scale_top="400"
            app:scale_width="155" />

        <WebView
            android:id="@+id/webview2_6"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:scale_height="310"
            app:scale_left="20"
            app:scale_textsize="50"
            app:scale_top="470"
            app:scale_width="310" />

        <TextView
            android:id="@+id/text_CR1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:textColor="#508ab9f2"
            app:scale_height="90"
            app:scale_left="345"
            app:scale_textsize="55"
            app:scale_top="400"
            app:scale_width="150" />

        <TextView
            android:id="@+id/text_CR2"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:textColor="#ffffff"
            app:scale_height="90"
            app:scale_left="485"
            app:scale_textsize="55"
            app:scale_top="400"
            app:scale_width="155" />

        <WebView
            android:id="@+id/webview2_7"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:scale_height="310"
            app:scale_left="345"
            app:scale_textsize="50"
            app:scale_top="470"
            app:scale_width="310" />

        <TextView
            android:id="@+id/text_YC1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:textColor="#508ab9f2"
            app:scale_height="90"
            app:scale_left="670"
            app:scale_textsize="55"
            app:scale_top="400"
            app:scale_width="150" />

        <TextView
            android:id="@+id/text_YC2"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:textColor="#ffffff"
            app:scale_height="90"
            app:scale_left="810"
            app:scale_textsize="55"
            app:scale_top="400"
            app:scale_width="155" />

        <WebView
            android:id="@+id/webview2_8"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:scale_height="310"
            app:scale_left="670"
            app:scale_textsize="50"
            app:scale_top="470"
            app:scale_width="310" />

        <TextView
            android:id="@+id/text_YP1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:textColor="#508ab9f2"
            app:scale_height="90"
            app:scale_left="995"
            app:scale_textsize="55"
            app:scale_top="400"
            app:scale_width="150" />

        <TextView
            android:id="@+id/text_YP2"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:textColor="#ffffff"
            app:scale_height="90"
            app:scale_left="1135"
            app:scale_textsize="55"
            app:scale_top="400"
            app:scale_width="155" />

        <WebView
            android:id="@+id/webview2_9"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:scale_height="310"
            app:scale_left="995"
            app:scale_textsize="50"
            app:scale_top="470"
            app:scale_width="310" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"

            app:scale_height="1200"
            app:scale_left="0"
            app:scale_top="780"
            app:scale_width="1320"/>

        <ImageView
            android:id="@+id/imageview"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginRight="3dp"
            android:text="@string/Second"
            app:scale_height="1150"
            app:scale_left="20"
            app:scale_top="840"
            app:scale_width="900" />

        <Button
            android:id="@+id/btnSH"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/sh_blue"
            app:scale_height="105"
            app:scale_left="205"
            app:scale_top="1030"
            app:scale_width="80" />

        <Button
            android:id="@+id/btnHS"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/hs_blue"
            app:scale_height="105"
            app:scale_left="287"
            app:scale_top="1175"
            app:scale_width="80" />

        <Button
            android:id="@+id/btnHS2"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/hs2_blue"
            app:scale_height="105"
            app:scale_left="210"
            app:scale_top="1130"
            app:scale_width="80" />

        <Button
            android:id="@+id/btnGJ"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/gj_blue"
            app:scale_height="105"
            app:scale_left="205"
            app:scale_top="1650"
            app:scale_width="80" />

        <Button
            android:id="@+id/btnCR"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/cr_blue"
            app:scale_height="105"
            app:scale_left="745"
            app:scale_top="1565"
            app:scale_width="80" />

        <Button
            android:id="@+id/btnYP"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/yp_blue"
            app:scale_height="105"
            app:scale_left="735"
            app:scale_top="1455"
            app:scale_width="80" />

        <Button
            android:id="@+id/btnKJ"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/kj_blue"
            app:scale_height="105"
            app:scale_left="670"
            app:scale_top="1495"
            app:scale_width="80" />

        <Button
            android:id="@+id/btnYC"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/yc_blue"
            app:scale_height="105"
            app:scale_left="610"
            app:scale_top="1445"
            app:scale_width="80" />

        <LinearLayout
            android:orientation="horizontal"
            android:id="@+id/textview"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/round_back"
            android:gravity="center"
            app:scale_height="1100"
            app:scale_left="900"
            app:scale_top="860"
            app:scale_width="400" />
        <android.support.v7.widget.RecyclerView
            android:id="@+id/alarm_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:overScrollMode="never"
            app:scale_height="1060"
            app:scale_left="920"
            app:scale_top="880"
            app:scale_width="360">
        </android.support.v7.widget.RecyclerView>

    </com.ssomai.android.scalablelayout.ScalableLayout>

</LinearLayout>

</android.support.v4.widget.SwipeRefreshLayout>

ssomai commented 6 years ago

안녕하세요~ 보여주신 코드도 사실상 ScalableLayout으로 화면전체를 레이아웃하시는건데요~ 이러면 당연히 비율이 다른 폰에서는 비율이 안 맞기 때문에 빈공간이 생기게 됩니다~

여기 내용 보시고 디자이너분에게 다양한 폰 비율에서 디자인이 어떻게 되어야 하는지 여쭤보시면 될것 같습니다~