마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

액티비티 스크롤과 액션바 메뉴

0 추천

아래 화면과 같은 layout을 짜고 싶습니다

화면 전체를 스크롤해서 내릴수 있고 

리스트뷰는 기본적으로 3개를 보여주지만 

아래 화살표를 누르면 늘어나면서 4rd 5rd가 나타납니다(이부분 부터 잘 모르겠습니다. 그리고 이미지뷰 크기가 의도와 다르게 나옵니다)

또 액션바의 = 표시를 누르면 

화면 오른쪽에서 아래 이미지 처럼 메뉴가 나타납니다

 

아래는 현재까지 작성한 

코드와 구동 화면입니다,

어떻게 구성,수정 면 될까요?

main.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.hp.plugapptest.MainActivity">

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="200dp"
        android:src="@drawable/plugtext"
        />


    <ListView
        android:id="@+id/plugList"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:dividerHeight="5dp"
        android:layout_marginTop="212dp"
        android:layout_below="@+id/imageView"
        android:layout_alignParentStart="true" />


</RelativeLayout>

 

lit_item.xml

<?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="90dp">

    <ImageView
        android:layout_width="90dp"
        android:layout_height="match_parent"
        android:id="@+id/PlugImg"
        android:layout_marginBottom="5dp"
        android:layout_marginTop="5dp"
        android:scaleType="centerInside"/>


    <TextView
        android:layout_width="180dp"
        android:layout_height="match_parent"
        android:text="New Text"
        android:id="@+id/Plugname"
        android:textSize="24dp"
        android:textColor="#000000"
        android:gravity="center_vertical"/>

    <ImageButton
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:id="@+id/PlugOnOffimg"
        android:background="#002d2db7"
        android:padding="0dp"
        android:layout_gravity="center_vertical"
        android:scaleType="centerInside" />
</LinearLayout>

 

 

신입 (570 포인트) 님이 2017년 5월 30일 질문
신입님이 2017년 5월 30일 수정

1개의 답변

0 추천
위에 액션바 누르면 메뉴뜨게하는건 네비게이션 드로어 사용하셔야합니다.

화살표버튼 누르면 늘어나게 하는건

버튼하나 만든 뒤에 그 버튼 이벤트 처리 메소드에서 리스트뷰에 아이템 하나씩 add 하면 될것같네요

 

그리고 화면에 스크롤 넣고싶다고 하셨는데 리스트뷰에도 스크롤이 있고 배경화면에도 스크롤이 있으면

난감한 상황이 많이 발생합니다... 현재대로 유지하시는게 나을것같고요

 

이미지뷰 크기는 xml 파일에서 width, heghit 수정하시면됩니다.

 

질문범위가 너무 광범위해서 세세하게는 설명을 못드리겠네요;;
애플립 (240 포인트) 님이 2017년 5월 30일 답변
...