Button doesn't appear in android appwidget layout -


i have xml file layout of appwidget:

    <?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="wrap_content"     android:orientation="vertical"     android:background="@android:color/black" >      <!-- listview shown on widget -->     <listview         android:id="@+id/listviewwidget"         android:layout_width="fill_parent"         android:layout_height="wrap_content" />      <button         android:id="@+id/refresh_appwidget"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:text="refresh"  />  </linearlayout> 

the button not displayed, , don't know cause. tested layout_with match_parent same result.

how can fix issue?

set fixed height listview example android:layout_height="400dp" in linearlayout.

or use relativelayout

or add button footer listview. can see button when scroll down

or add button header listview.

with relative layout can place button @ top or button , relative tot eh button can place listview.

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="fill_parent"     android:background="@android:color/black"     android:layout_height="fill_parent" >      <button         android:id="@+id/button1"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_alignparentbottom="true"         android:layout_centerhorizontal="true"         android:text="button" />      <listview         android:id="@+id/listview1"         android:layout_above="@+id/button1"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:layout_alignparenttop="true"         android:layout_centerhorizontal="true" >      </listview>  </relativelayout> 

Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -