728x90

 

 

 

목적 : 각레이아웃을 구분하는 표시선을 그으려고하는데 방법은?

 

노가다 방법으로 가장 많이?? 쓰이는거같은데

 

각 레이아웃에 View를 추가하여 weigth , height를 각각 martch나 1dp로 설정하여

background에 검정색을 추가해준다. (예제코드는 흰색으로 해놨음)

 

<?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:orientation="vertical"
    tools:context="com.example.project03.MainActivity"
    >

    <LinearLayout

        android:layout_width="match_parent"
        android:layout_height="50dp"
        android:gravity="center"
        android:orientation="horizontal"
        >


        <Button
            android:id="@+id/bt1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="화면1" />

        <Button
            android:id="@+id/bt2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="화면2" />

        <Button
            android:id="@+id/bt3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="화면3" />

    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="200dp"
        android:weightSum="2"
        >


            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                >
                <View
                    android:layout_width="match_parent"
                    android:layout_height="1dp"
                    android:layout_centerInParent="true"
                    android:background="#ffffff"
                    tools:layout_editor_absoluteX="-16dp"
                    tools:layout_editor_absoluteY="192dp" />
                <ImageView
                    android:id="@+id/image_view1"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:adjustViewBounds="true">
                </ImageView>




            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                >

                <View
                    android:layout_width="1dp"
                    android:layout_height="match_parent"
                    android:layout_centerInParent="true"
                    android:background="#ffffff"
                    tools:layout_editor_absoluteX="-16dp"
                    tools:layout_editor_absoluteY="192dp" />
                <View
                    android:layout_width="match_parent"
                    android:layout_height="1dp"
                    android:layout_centerInParent="true"
                    android:background="#ffffff"
                    tools:layout_editor_absoluteX="-16dp"
                    tools:layout_editor_absoluteY="192dp" />



            </LinearLayout>




    </LinearLayout>



    <FrameLayout
        android:id="@+id/main_frame"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        >

        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:layout_centerInParent="true"
            android:background="#ffffff"
            tools:layout_editor_absoluteX="-16dp"
            tools:layout_editor_absoluteY="192dp" />
    </FrameLayout>


</LinearLayout>

 

실행결과:

 

728x90

+ Recent posts