On 14 Gru, 10:26, Duygu Kahraman <[email protected]> wrote:
> I have a problem button visibility.I have 2 button from titlebar.I
> get their id from xml.but
> edit.setVisibility(View.INVISIBLE); doesnt work.What is
> wrong?I want to change their visibility programmatically.
>
> @Override
> public void onCreate(Bundle savedInstanceState) {
> super.onCreate(savedInstanceState);
>
> final boolean customTitle =
> requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
>
> setContentView(R.layout.main);
>
> edit=(Button)findViewById(R.id.edit);
> done=(Button)findViewById(R.id.done);
>
> edit.setVisibility(View.INVISIBLE);
> getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,
> R.layout.main);
>
> if ( customTitle ) {
> getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,
> R.layout.main);
> }
> main.xml:
> <?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">
> <Button android:id="@+id/edit"
> android:layout_width="57px"
> android:layout_height="wrap_content"
> android:text="edit"
> >
>
> </Button>
> <Button android:id="@+id/done"
> android:layout_width="57px"
> android:layout_height="wrap_content"
> android:text="done"
> >
>
> </Button>
>
> </LinearLayout>
why are you using R.layout.main both for activity content view:
setContentView(R.layout.main);
and for custom title (it is called even twice):
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,
R.layout.main);
pskink
--
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