android - Empty layout when running app -
i trying create linear layout android app. inside of linear layout there 2 other layouts, relative layout , linear layout. these 2 layouts have weight of 1. when looking @ layout @ graphical_layout looks fine. when running app on phone or virtual device see empty layout.
this how should (it screenshot of graphical_layout):
this how looks on virtual device , phone:
here xml code:
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#eeeeee" android:orientation="vertical" android:paddingleft="16dp" android:paddingright="16dp" tools:context="xx.xx.counter.mainactivity"> <relativelayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="2" > <progressbar android:id="@+id/progressbar2" style="?android:attr/progressbarstylehorizontal" android:layout_width="match_parent" android:layout_height="match_parent" android:progressdrawable="@drawable/cpb" android:rotation="270" /> <textview android:id="@+id/textview1" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_centerinparent="true" android:text="@string/number" android:gravity="center" android:textappearance="?android:attr/textappearancelarge" android:textsize="70sp" /> </relativelayout> <linearlayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:orientation="vertical" > <button android:id="@+id/button2" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="10dp" android:text="@string/button2" android:visibility="gone" /> <progressbar android:id="@+id/progressbar1" style="?android:attr/progressbarstylehorizontal" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="10dp" android:rotation="180" /> <textview android:id="@+id/textview2" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/number" /> </linearlayout> </linearlayout>
here code of cpb.xml:
<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@android:id/background"> <shape android:innerradiusratio="3.5" android:shape="ring" android:thicknessratio="60.0" android:uselevel="false"> <gradient android:startcolor="#aaaaaa" android:centercolor="#aaaaaa" android:endcolor="#aaaaaa" android:type="linear"/> </shape> </item> <item android:id="@android:id/progress"> <shape android:innerradiusratio="4" android:shape="ring" android:thicknessratio="20.0"> <gradient android:startcolor="#ff8800" android:centercolor="#ff8800" android:endcolor="#ff8800" android:type="linear"/> </shape> </item> </layer-list>
if change height , width of parent linear layout fill_parent or match_parent wrap_content not how want look. can see when running app not think problem oncreate() – methode.
so wrong layout, , have do, looks want look?
i don't see issue layout. works on nexus 5 phone. try change
android:layout_height="0dp"
to
android:layout_height="wrap_content"
also , make sure have setcontentview on activity oncreate
Comments
Post a Comment