如何使android布局(UI)同时适用于hdpi和xxhdpi
在我的布局中,所有内容文本和图像都通过服务器加载。当应用程序在hdpi和xxhdpi上运行时,底部布局组件不会显示 HDPI屏幕截图 XXHDPI屏幕截图 是否有任何方法使布局适合所有设备类别 下面是我的布局代码如何使android布局(UI)同时适用于hdpi和xxhdpi,android,android-layout,Android,Android Layout,在我的布局中,所有内容文本和图像都通过服务器加载。当应用程序在hdpi和xxhdpi上运行时,底部布局组件不会显示 HDPI屏幕截图 XXHDPI屏幕截图 是否有任何方法使布局适合所有设备类别 下面是我的布局代码 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:textAlignment="gravity" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="#ffebd5ca"
android:gravity="center"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_weight="0.4"
android:background="#ffebd5ca"
android:gravity="center"
android:orientation="vertical" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:src="@drawable/titlelogo" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ffebd5ca"
android:orientation="horizontal"
android:paddingLeft="8dp"
android:paddingRight="8dp" >
<TabHost
android:id="@android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</FrameLayout>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
android:background="#ffebd5ca"
android:showDividers="none"
android:tabStripEnabled="true"
android:tabStripLeft="@drawable/btnline2"
android:tabStripRight="@drawable/btnline2"
android:textAlignment="viewEnd"
android:layout_marginBottom="-4dp"
android:gravity="bottom" >
</TabWidget>
</LinearLayout>
</TabHost>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="0.3"
android:background="#ffebd5ca"
android:orientation="vertical"
android:paddingBottom="8dp"
android:paddingLeft="8dp"
android:paddingRight="8dp" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ff5a3e30" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:padding="8dp" >
<LinearLayout
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_gravity="center"
android:background="@drawable/logo_border"
android:gravity="center" >
<ImageView
android:id="@+id/mLogoAdView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:gravity="left|center_vertical"
android:orientation="vertical"
android:paddingLeft="10dp" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:orientation="vertical" >
<TextView
android:id="@+id/txtCompany"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SAMSUNG PVT LTD."
android:textColor="@color/tabhost_text_select"
android:textSize="12dp" />
<TextView
android:id="@+id/txtAddressLine1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="No 124, Main Street, Colombo 07"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#ffd3bdb2"
android:textSize="10dp" />
<TextView
android:id="@+id/txtTelephone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="12dp"
android:text="T.P : 011-2345678"
android:textColor="@color/tabhost_text_select"
android:textSize="10dp" />
<TextView
android:id="@+id/txtMobile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mobile : 011-2345678"
android:textColor="@color/tabhost_text_select"
android:textSize="10dp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
7英寸凸耳
在res文件夹下创建文件夹名-values-sw600dp
1.在values-sw600dp->创建dimen.xml下
10英寸标签
在res文件夹下创建文件夹名-values-sw720dp
1.在values-sw720dp->创建dimen.xml下
在五种主要密度中、高、x高、xx高和xxx高之间分别使用比例为2:3:4:6:8的dp值
值->dimens.xml
<dimen name="five_dp">5dp</dimen>
<dimen name="five_dp">10dp</dimen>
<dimen name="five_dp">15dp</dimen>
values-sw600dp->dimens.xml
<dimen name="five_dp">5dp</dimen>
<dimen name="five_dp">10dp</dimen>
<dimen name="five_dp">15dp</dimen>
values-sw600dp->dimens.xml
<dimen name="five_dp">5dp</dimen>
<dimen name="five_dp">10dp</dimen>
<dimen name="five_dp">15dp</dimen>
检查:@hareshchelana在我的布局中所有组件按服务器加载。是否有任何方法平衡内容?