2016-09-10 1 views
0

나는 네이티브 안드로이드에서 버튼과 편집 문구를 디자인하려고했지만 그림과 같이 정확한 UI를 만들 수 없습니다. 그런 UI를 만들 수있는 사람이 있다면 아이디어를 공유해주세요. 이미지에서 첫 번째 필드는 입력 상자로 작동하고 두 번째 필드는 버튼으로 작동해야합니다. enter image description here버튼 및 edittext의 사용자 정의 UI

+0

맞춤형 드로어 블이 필요하지만 둥근 모서리가있는 두 개의 필드 위에 떠 다니는 액션 버튼처럼 보입니다. 직사각형 조각의 둥근 모서리를 얻으려고 얼마나 멀리 얻었습니까? 나중에 서클에 대한 걱정 –

답변

1

다음 XML은 요청한 것과 동일한 UI를 생성합니다. :)

  1. 것은

    <?xml version="1.0" encoding="utf-8"?> 
    <shape xmlns:android="http://schemas.android.com/apk/res/android" 
    android:shape="rectangle"> 
    <solid android:color="#eeCD3E22" /> 
    <corners android:bottomRightRadius="30dp" 
    android:bottomLeftRadius="30dp" 
    android:topRightRadius="30dp" 
    android:topLeftRadius="30dp"/> 
        </shape> 
    
아래에 주어진

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
android:shape="rectangle"> 
<solid android:color="#eeC4C6C7" /> 
<corners android:bottomRightRadius="30dp" 
android:bottomLeftRadius="30dp" 
android:topRightRadius="30dp" 
android:topLeftRadius="30dp"/> 
</shape> 
  • 당김 폴더에 roundededittext.xml 리소스 파일을 만들고 아래에 주어진 당김 폴더에 roundedbutton.xml 리소스 파일을 생성

    기본 xml 레이아웃 파일을 만듭니다. 나는 아래에 주어진 귀하의 꾸밈음 Edittext로 만들었습니다

    <?xml version="1.0" encoding="utf-8"?> 
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="horizontal" android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_margin="20dp"> 
    
    <ImageButton 
        android:layout_width="50dp" 
        android:layout_height="50dp" 
        android:background="@drawable/roundedbutton" 
        android:elevation="10dp" 
        android:layout_gravity="center_vertical" 
        android:text="t" 
        /> 
    <EditText 
        android:layout_width="match_parent" 
        android:layout_height="45dp" 
        android:layout_marginLeft="-30dp" 
        android:elevation="2dp" 
        android:layout_gravity="center_vertical" 
        android:background="@drawable/roundededittext"/> 
    
        </LinearLayout> 
    

    희망이 있습니다. 의심의 여지가 있는지 물어보십시오.

  • +1

    감사. 너의 생각이 나에게 많은 도움이되었다. – JohnC