java如何在Android中以肖像模式设计10英寸平板电脑?
我必须为Android中的10英寸标签设计一个应用程序。但当我运行应用程序时,设计是模糊的或不清晰的。我不知道为什么。我还声明了清单中的安卓:screenOrientation="portrait"
。如何正确设计以及我在xml file
中哪里做错了。提前谢谢
这是我的xml文件代码
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:安卓="http://schemas.安卓.com/apk/res/安卓"
安卓:layout_width="match_parent"
安卓:layout_height="match_parent"
安卓:background="@安卓:color/white" >
<ImageView
安卓:id="@+id/imageLogoBBT"
安卓:layout_width="400dp"
安卓:layout_height="80dp"
安卓:layout_alignParentLeft="true"
安卓:layout_marginLeft="5dp"
安卓:layout_marginTop="5dp"
安卓:contentDescription="@string/desc"
安卓:scaleType="fitXY"
安卓:src="@drawable/banya_tree_logo" />
<ImageView
安卓:id="@+id/imageButtonBack"
安卓:layout_width="40dp"
安卓:layout_height="40dp"
安卓:layout_alignParentRight="true"
安卓:layout_alignParentTop="true"
安卓:layout_marginRight="15dp"
安卓:layout_marginTop="18dp"
安卓:contentDescription="@string/desc"
安卓:scaleType="fitCenter"
安卓:src="@drawable/back_img" />
<RelativeLayout
安卓:id="@+id/relImagLayout"
安卓:layout_width="match_parent"
安卓:layout_height="match_parent"
安卓:layout_below="@+id/imageLogoBBT"
安卓:background="@drawable/inner_back"
安卓:padding="5dp" >
<RelativeLayout
安卓:layout_width="match_parent"
安卓:layout_height="match_parent"
安卓:background="#E6E9E9" >
<TextView
安卓:id="@+id/textViewTitle"
安卓:layout_width="fill_parent"
安卓:layout_height="30dp"
安卓:layout_marginTop="5dp"
安卓:gravity="center"
安卓:text="@string/APPLICATION_FOR_FUND_TRANSFER"
安卓:textColor="#32241F"
安卓:textSize="25sp"
安卓:textStyle="bold" >
</TextView>
<TextView
安卓:id="@+id/APPLICANTS_INFORMATION_Detail"
安卓:layout_width="fill_parent"
安卓:layout_height="wrap_content"
安卓:layout_below="@+id/textViewTitle"
安卓:layout_marginLeft="10dp"
安卓:text="@string/APPLICANTS_INFORMATION"
安卓:textColor="#32241F"
安卓:textSize="20sp"
安卓:textStyle="bold" />
<LinearLayout
安卓:id="@+id/linearScroll"
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:layout_above="@+id/lastrowLayout"
安卓:layout_below="@+id/APPLICANTS_INFORMATION_Detail"
安卓:baselineAligned="false"
安卓:orientation="horizontal" >
<ScrollView
安卓:id="@+id/scrollFormOne"
安卓:layout_width="400dp"
安卓:layout_height="wrap_content"
安卓:layout_weight="0.25"
安卓:baselineAligned="false"
安卓:orientation="vertical"
安卓:padding="2dp" >
<LinearLayout
安卓:id="@+id/linearlayout_One"
安卓:layout_width="fill_parent"
安卓:layout_height="wrap_content"
安卓:baselineAligned="false"
安卓:orientation="vertical" >
<LinearLayout
安卓:id="@+id/linearlayout_textView"
安卓:layout_width="fill_parent"
安卓:layout_height="wrap_content"
安卓:baselineAligned="false"
安卓:orientation="horizontal" >
<TextView
安卓:layout_width="0dp"
安卓:layout_height="30dp"
安卓:layout_marginTop="5dp"
安卓:layout_weight="0.10"
安卓:gravity="left"
安卓:text="@string/title"
安卓:textColor="#241444"
安卓:textSize="19sp"
安卓:textStyle="normal" />
<TextView
安卓:layout_width="0dp"
安卓:layout_height="30dp"
安卓:layout_marginTop="5dp"
安卓:layout_weight="0.25"
安卓:gravity="left"
安卓:paddingLeft="5dp"
安卓:text="@string/last_name"
安卓:textColor="#241444"
安卓:textSize="19sp"
安卓:textStyle="normal" />
<TextView
安卓:layout_width="0dp"
安卓:layout_height="30dp"
安卓:layout_marginTop="5dp"
安卓:layout_weight="0.25"
安卓:gravity="left"
安卓:paddingLeft="5dp"
安卓:text="@string/first_name"
安卓:textColor="#241444"
安卓:textSize="19sp"
安卓:textStyle="normal" />
</LinearLayout>
<LinearLayout
安卓:id="@+id/linearlayout_EditText"
安卓:layout_width="fill_parent"
安卓:layout_height="wrap_content"
安卓:layout_marginTop="7dp"
安卓:baselineAligned="false"
安卓:orientation="horizontal" >
<Spinner
安卓:id="@+id/gps_spinnertitleName"
安卓:layout_width="0dp"
安卓:layout_height="40dp"
安卓:layout_marginTop="5dp"
安卓:layout_weight="0.10"
安卓:background="@drawable/button_shape"
安卓:gravity="center"
安卓:inputType="text"
安卓:textColor="#241444"
安卓:textSize="19sp"
安卓:textStyle="normal" />
<EditText
安卓:id="@+id/gps_edittextLastName"
安卓:layout_width="0dp"
安卓:layout_height="40dp"
安卓:layout_marginLeft="5dp"
安卓:layout_marginTop="5dp"
安卓:layout_weight="0.25"
安卓:background="@drawable/button_shape"
安卓:gravity="left"
安卓:inputType="text"
安卓:paddingLeft="5dp"
安卓:paddingTop="5dp"
安卓:textColor="#241444"
安卓:textSize="19sp"
安卓:textStyle="normal" />
<EditText
安卓:id="@+id/gps_editTextFirst"
安卓:layout_width="0dp"
安卓:layout_height="40dp"
安卓:layout_marginLeft="5dp"
安卓:layout_marginTop="5dp"
安卓:layout_weight="0.25"
安卓:background="@drawable/button_shape"
安卓:gravity="left"
安卓:inputType="text"
安卓:paddingLeft="5dp"
安卓:paddingTop="5dp"
安卓:textColor="#241444"
安卓:textSize="19sp"
安卓:textStyle="normal" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<ScrollView
安卓:id="@+id/scrollFrorm_Two"
安卓:layout_width="400dp"
安卓:layout_height="wrap_content"
安卓:layout_weight="0.25"
安卓:baselineAligned="false"
安卓:orientation="vertical"
安卓:padding="2dp" >
<LinearLayout
安卓:layout_width="fill_parent"
安卓:layout_height="wrap_content"
安卓:baselineAligned="false"
安卓:orientation="vertical" >
<TextView
安卓:layout_width="fill_parent"
安卓:layout_height="wrap_content"
安卓:layout_marginTop="5dp"
安卓:text="@string/Beneficiary_Address"
安卓:textColor="#241444"
安卓:textSize="19sp"
安卓:textStyle="normal" />
<EditText
安卓:id="@+id/gspET_Beneficiary_Address"
安卓:layout_width="fill_parent"
安卓:layout_height="80dp"
安卓:layout_marginTop="5dp"
安卓:background="@drawable/button_shape"
安卓:inputType="textMultiLine"
安卓:paddingLeft="5dp"
安卓:paddingTop="5dp"
安卓:textColor="#241444"
安卓:textSize="19sp" />
<TextView
安卓:layout_width="fill_parent"
安卓:layout_height="wrap_content"
安卓:layout_marginTop="15dp"
安卓:text="@string/Beneficiary_Account_No"
安卓:textColor="#241444"
安卓:textSize="19sp"
安卓:textStyle="normal" />
<EditText
安卓:id="@+id/gspET_Beneficiary_Account_No"
安卓:layout_width="fill_parent"
安卓:layout_height="40dp"
安卓:layout_marginTop="5dp"
安卓:background="@drawable/button_shape"
安卓:inputType="number"
安卓:paddingLeft="5dp"
安卓:paddingTop="5dp"
安卓:textColor="#241444"
安卓:textSize="19sp" />
<TextView
安卓:layout_width="fill_parent"
安卓:layout_height="wrap_content"
安卓:layout_marginTop="15dp"
安卓:text="@string/Beneficiary_Bank_Name"
安卓:textColor="#241444"
安卓:textSize="19sp"
安卓:textStyle="normal" />
<EditText
安卓:id="@+id/gspET_Beneficiary_Bank_Name"
安卓:layout_width="fill_parent"
安卓:layout_height="40dp"
安卓:layout_marginTop="5dp"
安卓:background="@drawable/button_shape"
安卓:inputType="text"
安卓:paddingLeft="5dp"
安卓:paddingTop="5dp"
安卓:textColor="#241444"
安卓:textSize="19sp" />
<TextView
安卓:layout_width="fill_parent"
安卓:layout_height="wrap_content"
安卓:layout_marginTop="15dp"
安卓:text="@string/Beneficiary_Bank_Address"
安卓:textColor="#241444"
安卓:textSize="19sp"
安卓:textStyle="normal" />
<EditText
安卓:id="@+id/gspET_Beneficiary_Bank_Address"
安卓:layout_width="fill_parent"
安卓:layout_height="80dp"
安卓:layout_marginTop="5dp"
安卓:background="@drawable/button_shape"
安卓:inputType="textMultiLine"
安卓:paddingLeft="5dp"
安卓:paddingTop="5dp"
安卓:textColor="#241444"
安卓:textSize="19sp" />
<TextView
安卓:layout_width="fill_parent"
安卓:layout_height="wrap_content"
安卓:layout_marginTop="15dp"
安卓:text="@string/BIC_Chips_ID_BSB_Code_Fed_Wire_ABA_Sort_Code"
安卓:textColor="#241444"
安卓:textSize="19sp"
安卓:textStyle="normal" />
<EditText
安卓:id="@+id/gspET_BIC_Chips_ID_BSB"
安卓:layout_width="fill_parent"
安卓:layout_height="40dp"
安卓:layout_marginTop="5dp"
安卓:background="@drawable/button_shape"
安卓:inputType="text"
安卓:paddingLeft="5dp"
安卓:paddingTop="5dp"
安卓:textColor="#241444"
安卓:textSize="19sp" />
<TextView
安卓:layout_width="fill_parent"
安卓:layout_height="wrap_content"
安卓:layout_marginTop="15dp"
安卓:text="@string/Intermediary_Bank_Name"
安卓:textColor="#241444"
安卓:textSize="19sp"
安卓:textStyle="normal" />
<EditText
安卓:id="@+id/gspET_Intermediary_Bank_Name"
安卓:layout_width="fill_parent"
安卓:layout_height="40dp"
安卓:layout_marginTop="5dp"
安卓:background="@drawable/button_shape"
安卓:inputType="text"
安卓:paddingLeft="5dp"
安卓:paddingTop="5dp"
安卓:textColor="#241444"
安卓:textSize="19sp" />
<TextView
安卓:layout_width="fill_parent"
安卓:layout_height="wrap_content"
安卓:layout_marginTop="15dp"
安卓:text="@string/Intermediary_Bank_Address"
安卓:textColor="#241444"
安卓:textSize="19sp"
安卓:textStyle="normal" />
<EditText
安卓:id="@+id/gspET_Intermediary_Bank_Address"
安卓:layout_width="fill_parent"
安卓:layout_height="80dp"
安卓:layout_marginTop="5dp"
安卓:background="@drawable/button_shape"
安卓:inputType="textMultiLine"
安卓:paddingLeft="5dp"
安卓:paddingTop="5dp"
安卓:textColor="#241444"
安卓:textSize="19sp" />
</LinearLayout>
</ScrollView>
</LinearLayout>
<LinearLayout
安卓:id="@+id/lastrowLayout"
安卓:layout_width="fill_parent"
安卓:layout_height="wrap_content"
安卓:layout_alignParentBottom="true"
安卓:layout_marginTop="7dp"
安卓:baselineAligned="false"
安卓:orientation="horizontal"
安卓:padding="10dp" >
<CheckBox
安卓:id="@+id/安卓"
安卓:layout_width="0dp"
安卓:layout_height="wrap_content"
安卓:layout_weight="0.50"
安卓:text="@string/I_Accept_Terms_Conditions"
安卓:textColor="@安卓:color/black" />
<ImageView
安卓:id="@+id/buttonSubmit_Next"
安卓:layout_width="0dp"
安卓:layout_height="70dp"
安卓:layout_weight="0.40"
安卓:contentDescription="@string/desc"
安卓:src="@drawable/next_btton" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
屏幕截图2014-06-24下午4时05分30分
# 1 楼答案
layout_width
或layout_height
缩放图像。我可以在ImageView
中看到您指定了dp
值,这将使系统缩放您的图像,这可能会导致模糊。相反,在可绘制文件夹中使用特定于大小和密度的资源,如您可以创建适合屏幕大小的特定布局,并将其放置在
res\layout-xxx
文件夹中尽可能使用9-patch图像
若您只有一个图像,并且必须为不同的屏幕缩放,那个么请使用最高分辨率的图像,并将其保存在drawable Nodepi文件夹中,指定高度或宽度,并让系统决定其他图像,以便正确缩放图像
阅读:http://developer.android.com/guide/practices/screens_support.html#screen-independence
图像缩放:http://argillander.wordpress.com/2011/11/24/scale-image-into-imageview-then-resize-imageview-to-match-the-image/
# 2 楼答案
10英寸平板电脑也可以使用不同的图像