logo
down
shadow

How to make a counter inside my tab layout like Whatsapp?


How to make a counter inside my tab layout like Whatsapp?

By : ashish chauhan
Date : October 18 2020, 01:08 AM
I wish this help you Right now I only have a simple tab layout working with a view pager. I would like to know how to customize my tab layout in order to have for example a functionality in my app to show in this the number of items in my recycler view for that fragment in my view pager.
code :
public View getTabView(Context context, int position) {
    int[] unreadCount = {3, 1, 2};

    View tab = LayoutInflater.from(context).inflate(R.layout.partial_custom_tab, null);
    tabText = (TextView) tab.findViewById(R.id.tab_title);
    counter = (View) tab.findViewById(R.id.tab_badge);
    tabText.setText(mPages.get(position).title);
    if (mPages.get(position).icon != null) {
        counter.setVisibility(View.VISIBLE);
        counter.setBackground(mPages.get(position).icon);
    } else {
        counter.setVisibility(View.GONE);
    }

    BadgeDrawable badge = new BadgeDrawable(getContext(),
            getResources().getColor(R.color.colorAccent));

    if (unreadCount[position] > 0) {
        counter.setVisibility(View.VISIBLE);
        badge.setCount(unreadCount[position]);
        badge.mutate();
        counter.setBackground(badge);
    } else {
        counter.setVisibility(View.GONE);
    }

    if (position == 0) {
        tab.setSelected(true);
    }
    return tab;
}


Share : facebook icon twitter icon
make views inside Layout match custom shape of layout

make views inside Layout match custom shape of layout


By : maniachhz
Date : March 29 2020, 07:55 AM
help you fix your problem You can't create a custom shape to a view. VIews are always rectangular. If you mean you have a custom background, that doesn't make the view group a custom shape, or effect the layout of views within the group. If you want to do that, you need to override onLayout (and possibly onMeasure) and layout the individual children with the bounds you expect them to be in. Do not be surprised if you get some ugly or non-functional results like this- views weren't made to be circular.
How can I use scan QR Code with a camera inside the layout (like Whatsapp Web scanner)

How can I use scan QR Code with a camera inside the layout (like Whatsapp Web scanner)


By : Ezgi Gaspak
Date : March 29 2020, 07:55 AM
Hope that helps Here is how I implemented something similar to what you need.
-Firstly, I used the Zxing library to implement this. So you need to add below dependency to your gradle:
code :
compile 'com.journeyapps:zxing-android-embedded:3.5.0'
<!-- language: lang-xml -->
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">


    <com.journeyapps.barcodescanner.DecoratedBarcodeView
        android:id="@+id/view_scanner"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/view_footer"
        android:soundEffectsEnabled="true" />

    <LinearLayout
        android:id="@+id/view_header"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:orientation="horizontal">

        <LinearLayout
            android:id="@+id/view_back"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center|top"
            android:orientation="horizontal">

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="@dimen/_10sdp"
                android:layout_marginTop="@dimen/_10sdp"
                android:src="@drawable/ic_back_light" />

        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="@dimen/_50sdp"
            android:gravity="right|top">

            <ImageView
                android:id="@+id/iv_flash"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginRight="@dimen/_10sdp"
                android:layout_marginTop="@dimen/_10sdp"
                android:src="@drawable/ic_flash_inactive" />
        </LinearLayout>
    </LinearLayout>


    <LinearLayout
        android:id="@+id/view_footer"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|center"
        android:gravity="center"
        android:orientation="vertical">

        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:layout_marginLeft="@dimen/_10sdp"
            android:layout_marginRight="@dimen/_10sdp"
            android:background="@android:color/darker_gray" />

        <TextView
            android:id="@+id/code_info"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:fontFamily="@string/font_sans_serif_light"
            android:padding="@dimen/_15sdp"
            android:text="@string/app_name"
            android:textColor="@android:color/white"
            android:textSize="@dimen/_15sdp" />


    </LinearLayout>

</FrameLayout>
private DecoratedBarcodeView barcodeView;

barcodeView = (DecoratedBarcodeView) findViewById(R.id.view_scanner);
barcodeView.setStatusText("");
barcodeView.decodeContinuous(callback);
private BarcodeCallback callback = new BarcodeCallback() {
    @Override
    public void barcodeResult(BarcodeResult result) {
        //Process your scan result here
        String resultString = result.getText();
    }

    @Override
    public void possibleResultPoints(List<ResultPoint> resultPoints) {
    }
};
Aligning linear layouts inside linear layout like whatsapp change profile picture

Aligning linear layouts inside linear layout like whatsapp change profile picture


By : user3134438
Date : March 29 2020, 07:55 AM
Does that help I am trying to design bottom modal sheet which will be displayed to user when they click to add / update profile picture like WhatsApp. For that - i have coded like below in xml file. , If you can use constraint layout then your layout could be like this
code :
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/linearLayout45"
    android:layout_width="match_parent"
    android:layout_height="match_parent">


<com.silverskysoft.skysalon.customViews.CircleImageView
    android:id="@+id/circleImageView"
    android:layout_width="52dp"
    android:layout_height="50dp"
    android:layout_marginStart="8dp"
    android:layout_marginTop="8dp"
    android:src="@drawable/ic_back"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

<TextView
    android:id="@+id/textView2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="8dp"
    android:text="Camera"
    android:textColor="#ffffff"
    android:textSize="10sp"
    android:textStyle="normal"
    app:layout_constraintEnd_toEndOf="@+id/circleImageView"
    app:layout_constraintStart_toStartOf="@+id/circleImageView"
    app:layout_constraintTop_toBottomOf="@+id/circleImageView" />


<com.silverskysoft.skysalon.customViews.CircleImageView
    android:id="@+id/circleImageView2"
    android:layout_width="51dp"
    android:layout_height="50dp"
    android:layout_marginStart="8dp"
    android:src="@drawable/ic_packages"
    app:layout_constraintStart_toEndOf="@+id/circleImageView"
    app:layout_constraintTop_toTopOf="@+id/circleImageView" />

<TextView
    android:id="@+id/textView3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="8dp"
    android:text="Gallery"
    android:textColor="#ffffff"
    android:textSize="10sp"
    android:textStyle="normal"
    app:layout_constraintEnd_toEndOf="@+id/circleImageView2"
    app:layout_constraintStart_toStartOf="@+id/circleImageView2"
    app:layout_constraintTop_toBottomOf="@+id/circleImageView2" />


<com.silverskysoft.skysalon.customViews.CircleImageView
    android:id="@+id/circleImageView3"
    android:layout_width="52dp"
    android:layout_height="50dp"
    android:layout_marginStart="8dp"
    android:src="@drawable/ic_signout"
    app:layout_constraintStart_toEndOf="@+id/circleImageView2"
    app:layout_constraintTop_toTopOf="@+id/circleImageView2" />

<TextView
    android:id="@+id/textView4"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="8dp"
    android:text="Remove"
    android:textColor="#ffffff"
    android:textSize="10sp"
    android:textStyle="normal"
    app:layout_constraintEnd_toEndOf="@+id/circleImageView3"
    app:layout_constraintStart_toStartOf="@+id/circleImageView3"
    app:layout_constraintTop_toBottomOf="@+id/circleImageView3" />
</androidx.constraintlayout.widget.ConstraintLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/linearLayout45"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal">


    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:padding="16dp"
        android:drawableTop="@drawable/camera"
        android:drawablePadding="8dp"
        android:text="Camera"
        android:textColor="#ffffff"
        android:textSize="10sp"
        android:textStyle="normal" />


    <TextView
        android:id="@+id/textView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:padding="16dp"
        android:text="Gallery"
        android:drawableTop="@drawable/gallery"
        android:drawablePadding="8dp"
        android:textColor="#ffffff"
        android:textSize="10sp"
        android:textStyle="normal" />


    <TextView
        android:id="@+id/textView4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dp"
        android:drawableTop="@drawable/image_delete"
        android:drawablePadding="8dp"
        android:padding="16dp"
        android:text="Remove"
        android:textColor="#ffffff"
        android:textSize="10sp"
        android:textStyle="normal" />
</LinearLayout>
How to make a Relative Layout Duplicate Itself Inside a Linear Layout On Button Click

How to make a Relative Layout Duplicate Itself Inside a Linear Layout On Button Click


By : FrozenFire
Date : March 29 2020, 07:55 AM
around this issue Create a separate layout xml file for RealtiveLayout that you want to inflate.
Example
Counter in PHP and preview with whatsapp facebook and twitter

Counter in PHP and preview with whatsapp facebook and twitter


By : tension Six
Date : March 29 2020, 07:55 AM
seems to work fine You can check from where the request is coming using $_SERVER['HTTP_REFERER'] - it will return the address of the page (if any) which referred the user agent to the current page. You can check if the referer is Facebook or Whatsapp and disable your variable counter.
Related Posts Related Posts :
  • Null data on resumed activity
  • Google Drive REST API : file.getCreatedTime() returns always null
  • android Transform Exception
  • Correct way to check disk space available for Android app?
  • Round up float .25
  • Android - deleting characters on button press
  • Android - one date and two time pickers in one dialog
  • Change background of particular item to a colour and other items to different colour
  • How to use horizontal view pager inside recycler view
  • Fragment is null whenever trying to reload fragment after a delete
  • Add horizontal line inside EditText
  • How to ask and accept all permissions in only one confirm alert dialog in Android 6.0
  • How to handle configuration change in Snackbar?
  • Android Studio 2.2.2 LLDB 2.2 update issue
  • Gradle build showing error when trying to add MapsActivity
  • In Android Intent why we write ActivityTwo.class in second argument?
  • Android - Connected Tests Results Directory
  • prevent partial overlapping of shape drawable stroke
  • How to rapidly prototype an image recognition application using Machine learning & neural network?
  • Volley RetryPolicy querying twice before timeout time is reached
  • Use custom RenderScript in system signed application
  • Automatic reply for whatsapp messages approach
  • Auto active/deactive Location & Data
  • error: cannot find symbol class Crashlytics and Fabric
  • SurfaceView how to Re-Create if it has been destroyed
  • Espresso idlingResource - how to register?
  • Change encoding of androidManifest.xml to UTF-8 in Android Studio 3
  • MS Syncframework 4 - no response after 5 minutes of server side processing
  • Kotlin clear an adapter
  • Parsing datetime to UTC
  • How to turn off keyboard icon at TimePicker?
  • How to make Primary key Auto increment while using Composite Primary keys in Room persistent library?
  • Passing between Activities using Intents
  • JSONObject fields in GSON class - Remains empty
  • Include headers directories for gradle generation with JNI interaction
  • ListView updates the entry only when the application is restarted again
  • SyncFailed Error:Cause: org/jetbrains/plugins/gradle/tooling/ModelBuilderService
  • minSdkVersion cannot be smaller than version 14 declared in library support-v4:26.0.0-alpha1 Manifest Merger Failed
  • Bluetooth connect works on some devices
  • How add space (e.g.height = 20dp) between searchView and dropdown list?
  • in Android studio Register New File Type Association for ttf
  • phoneGap 3.5.0 to 6.5.0 and api status was undifined
  • CountDownTimer - how to start from another method rather than Oncreate method
  • url not showing in WebView inside a Dialog
  • adjusting height of StackLayout element
  • I can't able to take my Images to new activity that are loaded from SD card
  • Paging Library invalidating data source not working
  • build.gradle warning 'avoid using + in version numbers'
  • NumberFormatException when setting SimpleDateFormat
  • How to add more work for 1 hit of "take image" button for camera app?
  • TabHost activity is not working
  • Travis CI - Android Build Script
  • Anko's uiThread sporadically not fired
  • Structure Database Firestore Posts
  • Displaying a Matrix
  • Adding a library with the notation ext: 'aar' or @aar doesn't import the transitive dependencies
  • Play Console Crash Reports (OutOfMemory)
  • Updated Android app built with Codename One instead of Android Studio
  • USB Communication with DTR/DTE enabled
  • This field leaks a context object
  • shadow
    Privacy Policy - Terms - Contact Us © soohba.com