Archive for 'Imageview'

It is not possible to add a UIImageView directly as a subView to UIWebView. So if you want to add a UIImageView object as a subview to UIWebView, use the following code.

Consider a UIWebVIew object myWebView, to which you want to add a UIImageView object, myImageView.

Now you can add myImageView to myWebView as follows :

In this code, we are adding the UIImageView object to the subview of the UIWebView, which is a UIScrollView.

Incoming search terms:

  • uiwebview addsubview
  • uiwebview uiimage
  • adding imageview dynamically in xcode
  • UIwebview addsubview uiimageview
  • uiwebview code for xcode
  • uiwebview subview
  • xcode 2 imageviews subview
  • xcode add image to subview
  • Xcode how to add imageView in UIView
  • uiimageview xcode3 2

The following code will make the UIImageView round cornered with border to it :

Incoming search terms:

  • ios CGRectMake round corner
  • how to make white border around images in android gallery programmatically
  • add border around image xcode
  • making uiimageview round cornered
  • objective c: how to creating a circular
  • photoshop round corner xcode round corner
  • programmatically create circular phone dialer in iOS
  • uiimage circle mask
  • uiimage rounded corners border
  • uiimageview border

Various Layout types in Android

The most commonly used layout classes in android are:

  • FrameLayout – designed to display a stack of child View controls. Multiple view controls can be added to this layout. This can be used to show multiple controls within the same screen space.
  • LinearLayout – designed to display child View controls in a single row or column. This is a very handy layout method for creating forms.
  • RelativeLayout – designed to display child View controls in relation to each other. For instance, you can set a control to be positioned “above” or “below” or “to the left of” or “to the right of” another control, referred to by its unique identifier. You can also align child View controls relative to the parent edges.
  • TableLayout – designed to organize child View controls into rows and columns. Individual View controls are added within each row of the table using a TableRow layout View (which is basically a horizontally oriented LinearLayout) for each row of the table.

     
     

    Defining an XML Layout Resource

    The most convenient and maintainable way to design application user interfaces is by creating XML layout resources.  XML layout resources must be stored in the /res/layout project directory (or, in the case of alternative resources, in a specially named sub-directory).

     
     

    The following is a simple XML layout resource, a template with a LinearLayout containing a TextView and an ImageView, defined in XML:

     
     

    <?xml version=”1.0″ encoding=”utf-8″?>  

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

    android:orientation=”vertical”  

       android:layout_width=”fill_parent”  

       android:layout_height=”fill_parent”  

       android:gravity=”center”>  

       <TextView  

               android:layout_width=”fill_parent”  

           android:id=”@+id/PhotoLabel”  

           android:layout_height=”wrap_content”  

           android:text=”@string/my_text_label”  

           android:gravity=”center_horizontal”  

           android:textSize=”20dp” />  

             <ImageView  

                 android:layout_width=”wrap_content”  

           android:layout_height=”wrap_content”  

           android:src=”@drawable/matterhorn”  

           android:adjustViewBounds=”true”  

           android:scaleType=”fitXY”  

           android:maxHeight=”250dp”  

           android:maxWidth=”250dp”  

           android:id=”@+id/Photo” />  

    </LinearLayout>  

The following layout will change the list view with image, title and description:

//list view layout xml

That’s it.

 

Incoming search terms:

  • android InsertImage title

Frame Animation in Android

I’ll discuss about creating a simple Frame animation in Android, using XML.

Create an XML file in /res/drawable/ directory in your Android project.

anim_frames.xml
<animation-list xmlns:android=”http://schemas.android.com/apk/res/android” android:oneshot=”true”>
<item android:drawable=”@drawable/f0″ android:duration=”600″ />
<item android:drawable=”@drawable/f1″ android:duration=”400″ />
<item android:drawable=”@drawable/f2″ android:duration=”400″ />
<item android:drawable=”@drawable/f3″ android:duration=”400″ />
<item android:drawable=”@drawable/f4″ android:duration=”400″ />
</animation-list>

 

Copy the images for animation (frames) into /res/drawable directory:
In this example, the frames are named as f0.png, f1.png, f2.png, f3.png and f4.png.

Structure of main.xml file.. (/res/layout/main.xml)
<?xml version=”1.0″ encoding=”utf-8″?>
<AbsoluteLayout xmlns:android=”http://schemas.android.com/apk/res/android”
xmlns:app=”http://schemas.android.com/apk/res/com.schogini.nurseryrhymesdemo”
android:orientation=”vertical”
android:layout_width=”fill_parent”
android:layout_height=”fill_parent”
android:background = “@drawable/title”
>

<ImageView
android:id=”@+id/imgFrame”
android:layout_x = “0px”
android:layout_y = “40px”
android:layout_width = “320px”
android:layout_height = “440px”
android:background = “@drawable/f0″>
</ImageView>
</AbsoluteLayout>

 

xmlAnimation.java
public class XmlAnimationDemo extends Activity {

/** Called when the activity is first created. */

Compile this and run, that’s it! Try out using your own images and transition effects.

Incoming search terms:

  • android animated png
  • media player with animation android
  • android create frame animation
  • animation in android example for walking
  • create animation in android example