android - In linearLayout i have got cutted upper part oh application -
what want achieve: both orientation looking buttons in linearlayout
<scrollview android:layout_height="match_parent" android:layout_width="match_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:background="#fffffce0"> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="#fffffce0" android:orientation="vertical" android:gravity="center" android:layout_gravity="center" > <button android:layout_width="match_parent" android:layout_height="90dp" android:id="@+id/bmnemo" android:layout_margintop="20dp" android:text="@string/bmnemo" android:textcolor="#ffffff" android:background="@drawable/custon_button_active" android:textsize="18sp" android:onclick="mnemotechniki" android:layout_weight="1" /> <button android:layout_width="match_parent" android:layout_height="70dp" android:id="@+id/bznasz" android:layout_gravity="center_horizontal" android:layout_margintop="40dp" android:background="@drawable/custon_button_active" android:text="@string/bznasz" android:textcolor="#ffffff" android:textsize="15sp" android:onclick="znasz" android:layout_weight="1" /> <button android:layout_width="match_parent" android:layout_height="70dp" android:id="@+id/b1000" android:layout_gravity="center_horizontal" android:layout_margintop="40dp" android:background="@drawable/custon_button_active" android:text="@string/b1000" android:textcolor="#ffffff" android:textsize="15sp" android:onclick="metoda1000" android:layout_weight="1" /> <button android:layout_width="match_parent" android:layout_height="70dp" android:id="@+id/bmoje" android:layout_margintop="40dp" android:background="@drawable/custom_button_unactive" android:text="@string/bmoje" android:textcolor="#ffffff" android:textsize="15sp" android:onclick="moje" android:layout_weight="1" android:layout_marginbottom="10dp" /> </linearlayout> </scrollview> <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/b_active_pressed" android:state_pressed="true" /> <item android:drawable="@drawable/b_active" android:state_focused="true" /> <item android:drawable="@drawable/b_active" /> </selector>
problem: when rotate screen on phone (to landscape, start screen) upper part of app cutted, in photo: http://zapodaj.net/15ab989809a33.jpg.html
(a (in picture) - cutted part)
use weight sum , remove margin top button layout.
<scrollview android:layout_height="match_parent" android:layout_width="match_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:background="#fffffce0"> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="#fffffce0" android:orientation="vertical" android:gravity="center" android:layout_gravity="center" android:weightsum="4" > <button android:layout_width="match_parent" android:layout_height="90dp" android:id="@+id/bmnemo" android:text="@string/bmnemo" android:textcolor="#ffffff" android:background="@drawable/custon_button_active" android:textsize="18sp" android:onclick="mnemotechniki" android:layout_weight="1" /> <button android:layout_width="match_parent" android:layout_height="70dp" android:id="@+id/bznasz" android:layout_gravity="center_horizontal" android:background="@drawable/custon_button_active" android:text="@string/bznasz" android:textcolor="#ffffff" android:textsize="15sp" android:onclick="znasz" android:layout_weight="1" /> <button android:layout_width="match_parent" android:layout_height="70dp" android:id="@+id/b1000" android:layout_gravity="center_horizontal" android:background="@drawable/custon_button_active" android:text="@string/b1000" android:textcolor="#ffffff" android:textsize="15sp" android:onclick="metoda1000" android:layout_weight="1" /> <button android:layout_width="match_parent" android:layout_height="70dp" android:id="@+id/bmoje" android:background="@drawable/custom_button_unactive" android:text="@string/bmoje" android:textcolor="#ffffff" android:textsize="15sp" android:onclick="moje" android:layout_weight="1"`` android:layout_marginbottom="10dp" /> </linearlayout> </scrollview>
Comments
Post a Comment