i write empty views to layout.xml.
id, layout width, height,  src, text.

sometime i write the code to build views, layout_params etc... , and its
hard to maintain.

i think i have to change style of making views to create views.xml.




2011/5/2 Dianne Hackborn <[email protected]>:
> I would really suggest just defining your layout in a layout XML resource
> file and using that.  It is a lot easier than writing the code to build the
> view hierarchy yourself.  Use LayoutInflator to create the views from the
> layout resource.
>
> On Sun, May 1, 2011 at 10:00 PM, smokerpg <[email protected]> wrote:
>>
>> thank you for advice.
>> i can show 3 views by using LinearLayout.
>>
>> <LinearLayout android:layout_width="wrap_content"
>>        android:layout_height="fill_parent" android:id="@+id/empty">
>>                        <ImageView android:id="@+id/emptyImage"
>> android:src="@drawable/img"
>>                                android:layout_width="wrap_content"
>> android:layout_height="wrap_content" />
>>                        <Button android:id="@+id/emptyButton"
>> android:layout_width="wrap_content"
>>                                android:layout_height="wrap_content" />
>> </LinearLayout>
>>
>>
>> i wonder why i couldn't show these views at first time, so i get file
>> from cvs and check it.
>> it is using LinearLayout inside LinearLayout.
>>
>> <LinearLayout android:layout_width="wrap_content"
>>        android:layout_height="fill_parent" android:id="@+id/empty">
>>     <LinearLayout android:layout_width="wrap_content"
>>              android:layout_height="wrap_content"
>> android:id="@+id/imagelayout">
>>                        <ImageView android:id="@+id/emptyImage"
>> android:src="@drawable/img"
>>                                android:layout_width="wrap_content"
>> android:layout_height="wrap_content" />
>>    </LinearLayout>
>>     <LinearLayout android:layout_width="wrap_content"
>>              android:layout_height="wrap_content"
>> android:id="@+id/buttonlayout">
>>                        <Button android:id="@+id/emptyButton"
>> android:layout_width="wrap_content"
>>                                android:layout_height="wrap_content" />
>>    </LinearLayout>
>> </LinearLayout>
>>
>> i don't know why not using RelativeLayout.
>> if i cen get time to recreate layout, i will chenge LinearLayout to
>> RelativeLayout.
>>
>> # now i can get clear understanding of [set] and [add]. thn.ak you.
>> # next time if i write mail like this, i will set title to "doesn't work".
>>
>> thanks.
>>
>>
>> 2011/4/28 Dianne Hackborn <[email protected]>:
>> > Btw you can pretty uniformly take a function that starts with "set" on
>> > Android to mean "replace whatever you previously had with the new value
>> > being supplied."
>> >
>> > On Thu, Apr 28, 2011 at 8:39 AM, Dianne Hackborn <[email protected]>
>> > wrote:
>> >>
>> >> No.  There is only one empty view.  If you want an empty view with
>> >> multiple things in it, use a layout manager and put your views inside
>> >> and
>> >> set the top-level layout manager as the empty view.
>> >>
>> >> On Wed, Apr 27, 2011 at 11:15 PM, kenichi kato <[email protected]>
>> >> wrote:
>> >>>
>> >>> hi guys.
>> >>>
>> >>> i try to set 3 empty view to ListView.
>> >>>
>> >>> at first, i try to set LinearLayout to EmptyView.
>> >>> but it doesn't work.
>> >>>
>> >>> so, i try this code.
>> >>>         listView.setEmptyView(findViewById(R.id.emptyImage));
>> >>>         listView.setEmptyView(findViewById(R.id.emptyButton));
>> >>>         listView.setEmptyView(findViewById(R.id.emptyText));
>> >>>
>> >>> but it shows only R.id.emptyImage.
>> >>>
>> >>> is there any way to set mutilple EmptyView to ListView?
>> >>>
>> >>> thanks.
>> >>>
>> >>> --
>> >>> ---------------------------------------------
>> >>> smokerpg
>> >>> PC: [email protected]
>> >>>
>> >>> --
>> >>> You received this message because you are subscribed to the Google
>> >>> Groups "Android Developers" group.
>> >>> To post to this group, send email to
>> >>> [email protected]
>> >>> To unsubscribe from this group, send email to
>> >>> [email protected]
>> >>> For more options, visit this group at
>> >>> http://groups.google.com/group/android-developers?hl=en
>> >>
>> >>
>> >> --
>> >> Dianne Hackborn
>> >> Android framework engineer
>> >> [email protected]
>> >>
>> >> Note: please don't send private questions to me, as I don't have time
>> >> to
>> >> provide private support, and so won't reply to such e-mails.  All such
>> >> questions should be posted on public forums, where I and others can see
>> >> and
>> >> answer them.
>> >>
>> >
>> >
>> >
>> > --
>> > Dianne Hackborn
>> > Android framework engineer
>> > [email protected]
>> >
>> > Note: please don't send private questions to me, as I don't have time to
>> > provide private support, and so won't reply to such e-mails.  All such
>> > questions should be posted on public forums, where I and others can see
>> > and
>> > answer them.
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups "Android Developers" group.
>> > To post to this group, send email to [email protected]
>> > To unsubscribe from this group, send email to
>> > [email protected]
>> > For more options, visit this group at
>> > http://groups.google.com/group/android-developers?hl=en
>>
>>
>>
>> --
>> ---------------------------------------------
>> smokerpg
>> PC: [email protected]
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>
>
>
> --
> Dianne Hackborn
> Android framework engineer
> [email protected]
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en



-- 
---------------------------------------------
smokerpg
PC: [email protected]

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to