多个屏幕的布局相同

时间:2017-04-24 11:54:30

标签: android

我的问题是当我为多个屏幕制作不同的布局时,例如布局小,布局正常等等。然后大多数nexus移动设备仅在布局正常时运行,因为在4英寸移动设备中,我的布局可以'能够适应,使它适合我制作布局 - 小但它适用于布局 - 大而不是布局小。

布局小

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
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.vishal.a4sa.SecondActivity"
android:weightSum="1"
android:background="@drawable/tooth3">

<Space
    android:layout_width="match_parent"
    android:layout_height="10dp" />

<TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:text="CATEGORIES"
    android:background="@drawable/button"
    android:gravity="center"
    android:textColor="#ffffff"
    android:textSize="35dp"
    android:textStyle="bold"
    android:id="@+id/categories"
    android:layout_gravity="center_horizontal" />

<Space
    android:layout_width="match_parent"
    android:layout_height="40dp" />

<br.com.bloder.magic.view.MagicButton
    android:id="@+id/instruments"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:magic_button_size="100dp"
    app:button_icon="@drawable/tools2"
    app:button_icon_width="70dp"
    app:button_icon_height="60dp"
    app:hide_text="INSTRUMENTS"
    app:icon_button_color="#ffffff"
    android:layout_marginTop="10dp"
    app:expandable_area_color="#ff0008"/>

<Space
    android:layout_width="match_parent"
    android:layout_height="30dp" />

<br.com.bloder.magic.view.MagicButton
    android:id="@+id/material"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:magic_button_size="100dp"
    app:button_icon="@drawable/material"
    app:button_icon_width="80dp"
    app:button_icon_height="60dp"
    app:hide_text="MATERIALS"
    app:icon_button_color="#ffffff"
    android:layout_marginTop="10dp"
    app:expandable_area_color="#ff0008"/>

<Space
    android:layout_width="match_parent"
    android:layout_height="20dp" />

<TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:text="ABOUT US"
    android:background="@drawable/button"
    android:gravity="center"
    android:layout_marginTop="10dp"
    android:textColor="#ffffff"
    android:textSize="35dp"
    android:textStyle="bold"
    android:id="@+id/aboutus" />

</LinearLayout>

布局正常

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
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.vishal.a4sa.SecondActivity"
android:weightSum="1"
android:background="@drawable/tooth3">

<Space
    android:layout_width="match_parent"
    android:layout_height="10dp" />

<TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:text="CATEGORIES"
    android:background="@drawable/button"
    android:gravity="center"
    android:textColor="#ffffff"
    android:textSize="35dp"
    android:textStyle="bold"
    android:id="@+id/categories"
    android:layout_gravity="center_horizontal" />

<Space
    android:layout_width="match_parent"
    android:layout_height="40dp" />

<br.com.bloder.magic.view.MagicButton
    android:id="@+id/instruments"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:magic_button_size="100dp"
    app:button_icon="@drawable/tools2"
    app:button_icon_width="70dp"
    app:button_icon_height="60dp"
    app:hide_text="INSTRUMENTS"
    app:icon_button_color="#ffffff"
    android:layout_marginTop="10dp"
    app:expandable_area_color="#ff0008"/>

<Space
    android:layout_width="match_parent"
    android:layout_height="30dp" />

<br.com.bloder.magic.view.MagicButton
    android:id="@+id/material"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:magic_button_size="100dp"
    app:button_icon="@drawable/material"
    app:button_icon_width="80dp"
    app:button_icon_height="60dp"
    app:hide_text="MATERIALS"
    app:icon_button_color="#ffffff"
    android:layout_marginTop="10dp"
    app:expandable_area_color="#ff0008"/>

<Space
    android:layout_width="match_parent"
    android:layout_height="80dp" />

<TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:text="ABOUT US"
    android:background="@drawable/button"
    android:gravity="center"
    android:layout_marginTop="10dp"
    android:textColor="#ffffff"
    android:textSize="35dp"
    android:textStyle="bold"
    android:id="@+id/aboutus" />

</LinearLayout>

0 个答案:

没有答案