WHAT'S NEW?
Loading...
Showing posts with label bootstrap. Show all posts
Showing posts with label bootstrap. Show all posts

 
SPAN6 EXAMPLE
 
Suppose you want this structure
 
<div class="row-fluid">
  <div class="span6"></div>
  <div class="span6"></div>
</div>
<div class="row-fluid">
  <div class="span6"></div>
  <div class="span6"></div>
</div>
 
If you are looping through $posts variable, and that the html is in the content property 
of each $post:

$i=0;
foreach ($posts as $post):
    if ($i%2==0) echo '<div class="row-fluid">';
      echo '<div class="span6">'. $post->content .'</div>';
    if ($i%2==1) echo '</div>';
    $i++;
endforeach; 

SPAN4 EXAMPLE 
 
 <div class="row-fluid">
  <div class="span4"></div>
  <div class="span4"></div> 
  <div class="span4"></div>
</div>
<div class="row-fluid">
  <div class="span4"></div>
  <div class="span4"></div>  
  <div class="span4"></div>
</div>

Display 6 random WordPress posts in 3 responsive columns and 2 rows

<?php
    $the_query = new WP_Query("showposts=6&cat=1&orderby=rand");
    while ( $the_query ->have_posts() ) {$the_query ->the_post(); $i++;
        if ($i == 1){echo "<div class=row-fluid>";}
        ?>
            <div class="span4">
                Random Post <?php echo $i ; ?>
            </div>
        <?php
        if ($i == 3){echo "</div><div class=row-fluid>";}
        if ($i == 6){echo "</div>";$i=0;}
    }
    wp_reset_postdata();
?>

Many times you are forced to write native Android apps, but you are not satisfied with the graphics. Good graphics is fundamental to make sure that the application will be a success. When you work in building a website, the facto standard is the Bootstrap framework, but when you work on mobile app is there anything like Twitter Bootstrap for Android? The answer is yes! You can use Android Bootstrap.



Android Bootstrap is a library which provides several custom views styled according to the Twitter Bootstrap specification. Using this library, you will be able to have Bootstrap style buttons with Font Awesome in your native Android application.

How can include Android-Bootstrap in your Android Studio project?

  • Copy Android-Bootstrap directory project into AndroidStudioProjects directory
  • Import the module "\AndroidStudioProjects\Android-Bootstrap\AndroidBootstrap" in your project  
  • If you read this error "Error:(10, 0) Could not find property 'VERSION_CODE' on ProductFlavor_Decorated....." then edit the file \AndroidStudioProjects\Android-Bootstrap\AndroidBootstrap\build.gradle, and change versionCode = Integer.parseInt(VERSION_CODE)  versionName = VERSION_NAME into  versionCode 1 versionName "1.0"
  •  at end of the file remove the row "apply from: 'https://raw.github.com/........."

Click the Try Again link to Synchronize your project

In your app project edit 

\src\main\res\values\styles.xml

add

edit your main activity layout \src\main\res\layout\activity_main.xml

add  xmlns:app attribute in the root element and add an AwesomeTextView



edit your main activity and add into onCreate method TypefaceProvider.registerDefaultIconSets();

That is all, you're ready to go!