저는 여러 화면을 지원해야하는 애플리케이션을 개발 중입니다. 정상적인 화면에서는 viewflipper 내부에 내 레이아웃을 설정하여 아이콘이 붐비지 않게했습니다. 하지만 큰 화면에서 수행하고자하는 작업은 viewflipper를 사용하지 않고 모든 아이콘을 하나의 레이아웃에 두어 화면을 활용하는 것입니다.안드로이드가 화면 크기를 결정합니다.
가 여기에 일반 화면 내 레이아웃입니다 :
<Button
android:id="@+id/ibMedicalAssessment"
android:layout_width="110dp"
android:layout_height="wrap_content"
android:padding="5dp"
android:contentDescription="@string/app_name"
android:text="@string/medicalassessment"
android:textStyle="bold"
android:textColor="@color/black"
android:layout_margin="20dp"
android:background="@drawable/custom_button"
android:drawableTop="@drawable/med_assessments" />
<Button
android:id="@+id/ibProfile"
android:layout_width="110dp"
android:layout_height="wrap_content"
android:padding="5dp"
android:contentDescription="@string/app_name"
android:text="@string/profile"
android:textStyle="bold"
android:layout_margin="20dp"
android:textColor="@color/black"
android:background="@drawable/custom_button"
android:drawableTop="@drawable/profile" />
</LinearLayout> <!-- 2nd row -->
</LinearLayout>
<LinearLayout
android:background="@color/white"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center_vertical|center" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:id="@+id/ibTests"
android:layout_width="110dp"
android:layout_height="wrap_content"
android:padding="5dp"
android:contentDescription="@string/app_name"
android:text="@string/tests"
android:textStyle="bold"
android:layout_margin="20dp"
android:textColor="@color/black"
android:background="@drawable/custom_button"
android:drawableTop="@drawable/tests" />
<Button
android:id="@+id/ibTreatment"
android:layout_margin="20dp"
android:layout_width="110dp"
android:layout_height="wrap_content"
android:padding="5dp"
android:contentDescription="@string/app_name"
android:text="@string/treatment"
android:textStyle="bold"
android:textColor="@color/black"
android:background="@drawable/custom_button"
android:drawableTop="@drawable/treatment" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:id="@+id/ibSpecialists"
android:layout_width="110dp"
android:layout_height="wrap_content"
android:padding="5dp"
android:contentDescription="@string/app_name"
android:text="@string/specialists"
android:textStyle="bold"
android:layout_margin="20dp"
android:textColor="@color/black"
android:background="@drawable/custom_button"
android:drawableTop="@drawable/specialists" />
<Button
android:id="@+id/ibDisclaimer"
android:layout_margin="20dp"
android:layout_width="110dp"
android:layout_height="wrap_content"
android:padding="5dp"
android:contentDescription="@string/app_name"
android:text="@string/about"
android:textStyle="bold"
android:textColor="@color/black"
android:background="@drawable/custom_button"
android:drawableTop="@drawable/disclaimer" />
</LinearLayout>
</LinearLayout>
</ViewFlipper>
</LinearLayout>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/lighterred"
android:layout_gravity="center"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/logo"
android:layout_gravity="center"
android:text="@string/app_name"
android:textSize="30sp"
android:padding="15dp"
android:textStyle="bold"
android:textColor="@color/white"
android:contentDescription="@string/app_name" />
<ViewFlipper
android:id="@+id/mainFlipper"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:background="@color/white"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:gravity="center_vertical|center"
android:orientation="vertical" >
<TextView
android:id="@+id/tvMainNote"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:text="@string/slidetoleft" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:id="@+id/ibSymptoms"
android:layout_width="110dp"
android:layout_height="wrap_content"
android:padding="5dp"
android:contentDescription="@string/app_name"
android:text="@string/symptoms"
android:textStyle="bold"
android:textColor="@color/black"
android:layout_margin="20dp"
android:background="@drawable/custom_button"
android:drawableTop="@drawable/symptoms" />
<Button
android:id="@+id/ibConditions"
android:layout_width="110dp"
android:layout_height="wrap_content"
android:padding="5dp"
android:contentDescription="@string/app_name"
android:text="@string/conditions"
android:textStyle="bold"
android:layout_margin="20dp"
android:textColor="@color/black"
android:background="@drawable/custom_button"
android:drawableTop="@drawable/conditions" />
그래서 어떻게 큰 화면에서 할 수 있어요?
감사 및 regrads.
[Fragments의 즐거움을 배울 때가되었습니다] (https://developer.android.com/guide/components/fragments.html) – FoamyGuy
@FoamyGuy 2.3과 호환됩니까? –
sdk와 함께 제공되어야하는 호환성 라이브러리를 사용하는 경우 (또는 sdk 관리자를 통해 다운로드 할 경우) – Raigex