2016-08-09 11 views
2

1.5에서 Android Studio 2.2를 설치 했으므로 익숙해지는 변경 사항이 많습니다.테두리를 추가하려면 어떻게해야합니까?

장치의 내용이 표시되고, 그래서 어느 부분을 구별하기 어려운 방법 만

enter image description here

공지 사항 미리보기 편집기, 방법은 다음과 같습니다 레이아웃 편집기에서, 나는 전화기 주위에 테두리를 갖고 싶어 나는 그것이 테두리 실제 전화와 같은 자세한 내용을 볼 수 있습니다 :

enter image description here

감사를 사전에 알려 주시기 바랍니다.

루치아

+0

하는 경우를 기본 화면을 볼 방법입니다 나는 밑에있다. 올바르게 서 있으면 UI를 디자인 할 때 레이아웃 편집기에서 전화 스킨을 표시하는 방법을 묻습니다. 그 맞습니까? –

+0

@ Code-Apprentice 네, 레이아웃 미리보기의 일부로 전화 화면의 테두리를 볼 수있었습니다. –

답변

0

미리보기 창의 오른쪽 상단에는 파란색 기어가 ​​있습니다. 이것을 클릭하여 "장치 프레임 포함"이 선택되어 있는지 확인하십시오. AS 2.1.2에서는 기본적으로 확인 된 것으로 보이지만 어떤 이유로 장치 프레임이 표시되지 않습니다. 미리보기 창 (페이지 아이콘과 Android 헤드가있는 툴바)의 툴바 왼쪽 상단에있는 버튼을 클릭하고 "미리보기 ..."옵션 중 하나를 선택하여 표시되도록 할 수있었습니다. 버튼을 다시 클릭하고 "없음"을 선택하십시오. 이 기능은 예상대로 작동하지 않는 것으로 보입니다.

+0

흠 ... 맥에서는 다릅니 까? 오른쪽 상단에 파란색 장비가 보이지 않습니다. –

+0

당신을위한 장소를 가리키는 스크린 샷을 첨부 할 수 있습니까? –

+0

지금 바로 스크린 샷을 얻을 수 없습니다. "오른쪽 상단"이라고 말하면 미리보기 영역의 오른쪽 상단입니다. 오른쪽에는 속성과 같은 다른 창이 있습니다. (죄송합니다. 설치된 ATM이 컴퓨터에 설치되어 있지 않으므로 메모리 ATM에서이 작업을 수행하고 있습니다.) –

1

AS 2.2에는 편집기 영역에 안드로이드 폰 스킨을 표시하는 옵션이없는 것으로 보입니다. 확인 this 게시물

하지만 편집기의 전화 화면에서 모든 것을 볼 수 있습니다. 상태 표시 줄과 하단 검은 색 탐색 영역. 하단 검은 색 탐색 영역은 해당 영역을 지원하는 전화 모델에만 나타납니다. 당신은 넥서스 1에서 그것을 얻지 못할 것이지만 넥서스 4에서 그것을 얻을 것입니다. 당신은 편집기 영역의 상단 막대에서 올바른 모델을 선택할 수 있습니다.

또한 도구 모음이 xml에 제대로 추가되면 올바르게 표시됩니다. 이것은 내가 내 편집기에서

enter image description here

activity_main.xml

<?xml version="1.0" encoding="utf-8"?> 
<android.support.design.widget.CoordinatorLayout 
    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:fitsSystemWindows="true" 
    tools:context="com.example.sample.MainActivity"> 

    <android.support.design.widget.AppBarLayout 
     android:layout_height="wrap_content" 
     android:layout_width="match_parent" 
     android:theme="@style/AppTheme.AppBarOverlay"> 

     <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      android:background="?attr/colorPrimary" 
      app:popupTheme="@style/AppTheme.PopupOverlay" /> 

    </android.support.design.widget.AppBarLayout> 

    <include layout="@layout/content_main"/> 

    <android.support.design.widget.FloatingActionButton 
     android:id="@+id/fab" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="bottom|end" 
     android:layout_margin="@dimen/fab_margin" 
     android:src="@android:drawable/ic_dialog_email" /> 

</android.support.design.widget.CoordinatorLayout> 

content_main.xml

<?xml version="1.0" encoding="utf-8"?> 
<android.support.constraint.ConstraintLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/content_main" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    tools:showIn="@layout/activity_main" 
    tools:context="com.example.sample.MainActivity" 
    tools:layout_editor_absoluteX="0dp" 
    tools:layout_editor_absoluteY="81dp"> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Hello World!" 
     tools:layout_editor_absoluteX="154dp" 
     tools:layout_editor_absoluteY="247dp" /> 

</android.support.constraint.ConstraintLayout> 

MainActivity.java

import android.os.Bundle; 
import android.support.design.widget.FloatingActionButton; 
import android.support.design.widget.Snackbar; 
import android.support.v7.app.AppCompatActivity; 
import android.support.v7.widget.Toolbar; 
import android.view.View; 
import android.view.Menu; 
import android.view.MenuItem; 

public class MainActivity extends AppCompatActivity { 

    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_main); 
     Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); 
     setSupportActionBar(toolbar); 

     FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); 
     fab.setOnClickListener(new View.OnClickListener() { 
      @Override 
      public void onClick(View view) { 
       Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) 
         .setAction("Action", null).show(); 
      } 
     }); 
    } 

    @Override 
    public boolean onCreateOptionsMenu(Menu menu) { 
     // Inflate the menu; this adds items to the action bar if it is present. 
     getMenuInflater().inflate(R.menu.menu_main, menu); 
     return true; 
    } 

    @Override 
    public boolean onOptionsItemSelected(MenuItem item) { 
     // Handle action bar item clicks here. The action bar will 
     // automatically handle clicks on the Home/Up button, so long 
     // as you specify a parent activity in AndroidManifest.xml. 
     int id = item.getItemId(); 

     //noinspection SimplifiableIfStatement 
     if (id == R.id.action_settings) { 
      return true; 
     } 

     return super.onOptionsItemSelected(item); 
    } 
} 
+0

새 AS에서 테두리를 사용할 수 없습니까? –

+0

링크에 편집기 영역 스크린 샷이 있으며 장치 스킨을 활성화하는 옵션을 찾을 수 없다는 것을 알지 못한다면 편집기에서 같은 것을 보길 바랍니다. 왜 당신은 장치 피부를보고 싶습니까? 시스템 바 및 장식으로 전체 화면을 보는 것만으로 충분하지 않습니까? – random

관련 문제