2016-07-03 3 views
0

나는 바닥을 중심으로 여러 개의 입력 필드와 두 개의 버튼이있는 화면이 휴대폰에 그것은 다음과 같습니다.화면 레이아웃이 Tablet에서 방해되었습니다. 태블릿 에뮬레이터에서 잘 작동하고 5 "안드로이드에 전화

Phone view (looks same on tablet emulator)

그러나 태블릿에 보이는 같은 아래와 같이.

On tablet device

내가 그것을 전화에서 어떻게 보이는지의 확대 버전을 필요로하는 모든 뷰 (textinputlayout, 버튼, 글꼴 크기, 힌트) 모든 것이 동일하지만, 큰에 큰 보일 것처럼 화면 크기. 큰 화면에서 축소해야하며 휴대 전화의 모양과 일치해야합니다.

이 방법이 있습니까?

저는 모든 치수를 dp로 지정하고 LinearLayout을 ViewGroup으로 사용했습니다. 의 minSdkVersion 아래에 붙여 넣기로 19

내 코드입니다 :

안드로이드 또는 작동해야하지 어떻게
<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/header_left_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="60dp" 
    android:orientation="vertical" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    android:weightSum="100.0" 
    tools:context=".OutletDetailsActivity" 
    tools:showIn="@layout/activity_outlet_details" 
    android:focusable="true" 
    android:focusableInTouchMode="true" 
    android:background="@drawable/app_bg"> 


    <com.admin.view.CustomFontTextView 
     android:id="@+id/registerOutletHeader" 
     android:layout_weight="6.0" 
     android:layout_gravity="center" 
     style="@style/screenHeader" 
     /> 

    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/ScrollViewRegisterBox" 
     android:layout_width="wrap_content" 
     android:layout_weight="75.0" 
     android:layout_marginLeft="@dimen/activity_horizontal_margin" 
     android:layout_marginRight="@dimen/activity_horizontal_margin" 
     android:layout_gravity="center" 
     android:layout_height="0dp" 
     android:scrollbarSize="3dp" 
     android:scrollbarThumbVertical="@color/floating_line"> 

     <LinearLayout 
      android:layout_width="300dp" 
      android:layout_height="wrap_content" 
      android:paddingBottom="@dimen/activity_vertical_margin" 
      android:paddingLeft="@dimen/activity_horizontal_margin" 
      android:paddingRight="@dimen/activity_horizontal_margin" 
      android:orientation="vertical" 
      android:paddingTop="@dimen/register_box_top_margin" 
      android:id="@+id/registerContainerBox" 
      > 

      <android.support.design.widget.TextInputLayout 
       android:id="@+id/inputOutletNameLayout" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="5dp" 
       android:layout_marginRight="5dp" 
       android:layout_marginTop="10dp"> 

       <com.admin.view.CustomFontEditText 
        android:id="@+id/inputOutletNameText" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:hint="@string/outlet_name" 
        android:inputType="text" 
        android:theme="@style/inputText"/> 
      </android.support.design.widget.TextInputLayout> 

      <android.support.design.widget.TextInputLayout 
       android:id="@+id/inputaddressLine1Layout" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="5dp" 
       android:layout_marginRight="5dp" 
       android:layout_marginTop="15dp"> 

       <com.admin.view.CustomFontEditText 
        android:id="@+id/inputaddressLine1Text" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:hint="@string/address_line1" 
        android:inputType="textPostalAddress" 
        android:theme="@style/inputText"/> 
      </android.support.design.widget.TextInputLayout> 

      <android.support.design.widget.TextInputLayout 
       android:id="@+id/inputaddressLine2Layout" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="5dp" 
       android:layout_marginRight="5dp" 
       android:layout_marginTop="15dp"> 

       <com.admin.view.CustomFontEditText 
        android:id="@+id/inputaddressLine2Text" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:hint="@string/address_line2" 
        android:inputType="textPostalAddress" 
        android:theme="@style/inputText"/> 
      </android.support.design.widget.TextInputLayout> 

      <android.support.design.widget.TextInputLayout 
       android:id="@+id/inputPinCodeLayout" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="5dp" 
       android:layout_marginRight="5dp" 
       android:layout_marginTop="15dp"> 

       <com.admin.view.CustomFontEditText 
        android:id="@+id/inputPinCodeText" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:hint="@string/pin_code" 
        android:inputType="number" 
        android:maxLength="6" 
        android:theme="@style/inputText" /> 
      </android.support.design.widget.TextInputLayout> 

      <android.support.design.widget.TextInputLayout 
       android:id="@+id/inputEmailLayout" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="5dp" 
       android:layout_marginRight="5dp" 
       android:layout_marginTop="15dp"> 

       <com.admin.view.CustomFontEditText 
        android:id="@+id/inputEmailText" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:hint="@string/email_id" 
        android:inputType="textEmailAddress" 
        android:theme="@style/inputText"/> 
      </android.support.design.widget.TextInputLayout> 

      <android.support.design.widget.TextInputLayout 
       android:id="@+id/inputPhoneNumberLayout" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="5dp" 
       android:layout_marginRight="5dp" 
       android:layout_marginTop="15dp"> 

       <com.admin.view.CustomFontEditText 
        android:id="@+id/inputPhoneNumberText" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:hint="@string/mobile_number" 
        android:inputType="number" 
        android:maxLength="10" 
        android:theme="@style/inputText"/> 
      </android.support.design.widget.TextInputLayout> 

     </LinearLayout> 
    </ScrollView> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_marginTop="5dp" 
     android:layout_weight="19.0" 
     android:weightSum="6"> 

     <com.admin.view.CustomFontButton 
      android:id="@+id/reset_button" 
      style="@style/formButton" 
      android:layout_marginLeft="60dp" 
      android:layout_weight="1" 
      android:text="Reset" 
      android:layout_gravity="center" 
      /> 

     <com.admin.view.CustomFontButton 
      android:id="@+id/registerOutletNextButton" 
      style="@style/formButton" 
      android:layout_marginLeft="30dp" 
      android:layout_weight="1" 
      android:text="Register" 
      android:layout_gravity="center" /> 
    </LinearLayout>`enter code here` 
</LinearLayout> 

답변

0

. 태블릿보기가 정확합니다. 거기에 모든 것을 넣을 수있는 충분한 공간이있어 모든 것을 표시합니다. 실제로 축소하는 것만으로는보기가 힘듭니다. 나는 당신이 읽을 것을 권합니다 https://developer.android.com/guide/practices/screens_support.html

또한 모든 전화기에서 똑같이 보일 수 없습니다. 나는 6 인치 폰을 가지고있다. 그것은 당신이 보는 태블릿과 전화 화면 사이의 어딘가에서 보일 것이다.