Imageview ("headbar") Different Screens Etc
I just want to make an ImageView as my headbar ... it should just fill out his parent linear-layout.. apparently it does not. is there any way to tell the scaleType just to fit its
Solution 1:
You need to use three types of layouts in general
Also you need to use three values layouts in general
values-hdpi
values-mdpi
values-ldpi
Here i explain for LDPI Device Header you have to do for all you device HDPI,MDPI, etc
For example simple xml that has Image as Header : layout-ldpi - Header
<?xml version="1.0" encoding="UTF-8"?><RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="fill_parent"android:layout_height="50px"android:orientation="horizontal" ><ImageViewandroid:id="@+id/header_main_title"android:layout_marginTop="10dip"android:layout_width="wrap_content"android:layout_height="50dip"android:background="@drawable/header_image"android:layout_centerHorizontal="true"android:layout_marginRight="10dip"
/>
Similarly values-ldpi contains
<?xml version="1.0" encoding="utf-8"?><resources><stylename="MyTheme"parent="android:Theme"><itemname="android:windowTitleSize">50px</item><itemname="android:windowTitleBackgroundStyle">@style/WindowTitleBackground
</item></style></resources>
Similarly for Styles.xml :
<?xml version="1.0" encoding="UTF-8"?><resources><stylename="WindowTitleBackground"parent="android:WindowTitleBackground"><itemname="android:background">@android:color/transparent</item></style>
In your Manifest.xml include this Line :
<application android:icon="@drawable/vmi_icon" android:label="@string/app_name" android:theme="@style/MyTheme" >
Put the Styles.xml and Themes.xml inside of values-ldpi folder
I shown Header for ldpi device similarly you need to create for MDPI and HDPI device
changes should be made in this line of all
if it's HDPI :
<itemname="android:windowTitleSize">100px</item>
If it's Mdpi :
<itemname="android:windowTitleSize">70px</item>
Similarly for header.xml :
if it's HDPI :
android:layout_height="100px"
If it's Mdpi :
android:layout_height="70px"
Post a Comment for "Imageview ("headbar") Different Screens Etc"