android layout - Button text lost when in landscape mode -
i have simple screen 4 buttons , images:
and when change landscape mode images cropped , text lost:
i using linear layout follows:
<?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:layout_alignparentbottom="true" android:layout_centerhorizontal="true" android:orientation="vertical" android:background="@drawable/rings" > <linearlayout android:id="@+id/row1" android:layout_width="fill_parent" android:layout_height="match_parent" android:layout_weight="1" android:gravity="top|fill_vertical" android:orientation="horizontal" > <button android:id="@+id/classesbutton" android:layout_width="0dp" android:layout_height="fill_parent" android:layout_weight="1" android:background="@android:drawable/menuitem_background" android:contentdescription="@string/title_activity_class_list" android:drawablebottom="@drawable/ic_classes" android:onclick="viewclasses" android:scaletype="fitcenter" android:text="@string/classes" android:minlines="1" android:textcolor="@android:color/primary_text_light" /> <button android:id="@+id/studentsbutton" android:layout_width="0dp" android:layout_height="fill_parent" android:layout_weight="1" android:background="@android:drawable/menuitem_background" android:drawablebottom="@drawable/ic_students" android:onclick="viewstudents" android:scaletype="fitcenter" android:text="@string/students" android:minlines="1" android:textcolor="@android:color/primary_text_light" /> </linearlayout> <linearlayout android:id="@+id/row2" android:layout_width="fill_parent" android:layout_height="match_parent" android:layout_weight="1" android:gravity="bottom|fill_vertical" android:orientation="horizontal" > <button android:id="@+id/levelsbutton" android:layout_width="0dp" android:layout_height="fill_parent" android:layout_weight="1" android:background="@android:drawable/menuitem_background" android:contentdescription="@string/levels" android:drawablebottom="@drawable/ic_levels" android:minlines="1" android:onclick="viewlevels" android:scaletype="fitcenter" android:text="@string/levels" android:textcolor="@android:color/primary_text_light" /> <button android:id="@+id/skillsbutton" android:layout_width="0dp" android:layout_height="fill_parent" android:layout_weight="1" android:background="@android:drawable/menuitem_background" android:contentdescription="@string/skills" android:drawablebottom="@drawable/ic_skills" android:onclick="viewskills" android:scaletype="fitcenter" android:text="@string/skills" android:minlines="1" android:textcolor="@android:color/primary_text_light" /> </linearlayout> </linearlayout>
update changed scale type fitcenter , expected solve issue has not. puzzled why scaling doesn't resize image fit inside layout when seems others have found scale images fit on screens.
i have experimented using relative layout can't find easy way have 4 buttons fill screen equally.
thanks in advance, i've spent far time on this!
you change scale type
of images see option work best (may not work due fill_parent
& weight
of images).
you make textviews
, put text above images instead of having button text (personal preference).
if link me 4 images figure out :)
markus
Comments
Post a Comment