Monday, July 22, 2013

Re: [android-developers] Re: switch widget reseting styles on inflating

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

    android:id="@+id/inputsLayout"

    android:layout_width="match_parent"

    android:layout_height="wrap_content"

    android:orientation="horizontal" >

    <TextView 

        android:id="@+id/reportName"

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:layout_gravity="left"

        />

    <Switch

        android:id="@+id/yesNoSwitch"

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:layout_gravity="right"

        android:textOff="no"

        android:textOn="yes" />


    <ImageButton

        android:layout_width="wrap_content"

        android:layout_height="wrap_content"

        android:id="@+id/camera"

        android:layout_gravity="right"

        style="@style/ImgButton"

        android:src="@drawable/device_access_camera" />

</LinearLayout>

This is where i got declared the switch.(report_task_form.xml)
Then I use the LayoutInflater - 

LayoutInflater inflater = (LayoutInflater)activity.getApplicationContext().getSystemService

                (Context.LAYOUT_INFLATER_SERVICE);

        LinearLayout layout = (LinearLayout) inflater.inflate(R.layout.report_task_form, null);

Then i simple use addView to add this layout to another. 

The result are - https://www.dropbox.com/s/cex7rq08fmi02tv/Screen%20Shot%202013-07-22%20at%204.45.46%20PM.png and https://www.dropbox.com/s/m3hryjtujoc6icx/Screen%20Shot%202013-07-22%20at%204.48.34%20PM.png

Any ideas ? 

--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate