This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
compile fileTree(dir: 'libs', include: ['*.jar']) | |
testCompile 'junit:junit:4.12' | |
compile 'com.android.support:support-v4:23.1.0' | |
compile 'com.android.support:appcompat-v7:23.1.0' | |
compile 'com.android.support:design:23.1.0' | |
compile 'com.jakewharton:butterknife:7.0.1' | |
compile 'com.android.support:cardview-v7:23.1.0' | |
compile 'com.android.support:recyclerview-v7:23.1.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let jsonString = "{\"id\":123,\"Name\":\"Munish\"}" | |
// convert String to NSData | |
var data: NSData =jsonString.dataUsingEncoding(NSUTF8StringEncoding)! | |
var error: NSError? | |
// convert NSData to 'AnyObject' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity extends FragmentActivity{ | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setUpView(); | |
setUpFragment(); | |
} | |
void setUpView(){ | |
setContentView(R.layout.activity_main); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TabsPagerAdapter extends PagerAdapter { | |
String tabs[]={"Test 1","Test 2","Test 3","Test 4","Test 5","Test 6","Test 7","Test 8"}; | |
Activity activity; | |
public TabsPagerAdapter(Activity activity){ | |
this.activity=activity; | |
} | |
@Override | |
public int getCount() { | |
return tabs.length; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SlidingFragment extends Fragment { | |
private SlidingTabLayout mSlidingTabLayout; | |
private ViewPager mViewPager; | |
@Override | |
public View onCreateView(LayoutInflater inflater, ViewGroup container, | |
Bundle savedInstanceState) { | |
return inflater.inflate(R.layout.fragment_sample, container, false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SlidingTabStrip extends LinearLayout { | |
private static final int DEFAULT_BOTTOM_BORDER_THICKNESS_DIPS = 2; | |
private static final byte DEFAULT_BOTTOM_BORDER_COLOR_ALPHA = 0x26; | |
private static final int SELECTED_INDICATOR_THICKNESS_DIPS = 8; | |
private static final int DEFAULT_SELECTED_INDICATOR_COLOR = 0xFF33B5E5; | |
private static final int DEFAULT_DIVIDER_THICKNESS_DIPS = 1; | |
private static final byte DEFAULT_DIVIDER_COLOR_ALPHA = 0x20; | |
private static final float DEFAULT_DIVIDER_HEIGHT = 0.5f; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.manishkpr.slidingtabsexample.R; | |
import android.annotation.SuppressLint; | |
import android.content.Context; | |
import android.graphics.Typeface; | |
import android.os.Build; | |
import android.support.v4.view.PagerAdapter; | |
import android.support.v4.view.ViewPager; | |
import android.util.AttributeSet; | |
import android.util.TypedValue; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:orientation="vertical" | |
android:gravity="center"> | |
<TextView | |
android:id="@+id/item_title" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:orientation="vertical" | |
android:gravity="center"> | |
<TextView | |
android:id="@+id/item_title" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<LinearLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
android:orientation="vertical" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:id="@+id/sample_main_layout"> | |
<FrameLayout | |
android:id="@+id/sample_content_fragment" | |
android:layout_weight="2" |