How to Zoom in and out layout in Android CardView










0















I need your kind help to guide me to use Zoom in and out the layout in Android CardView via on click .



Card view is connected to arrayadapter.



Also is it possible to do this on ConstraintLayout(ConstraintLayout is in side the LinearLayout?



Card XML



<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@android:color/white"
android:clipToPadding="false"
android:outlineProvider="bounds"
android:paddingBottom="10sp"
android:paddingLeft="15sp"
android:paddingRight="15sp"
android:paddingTop="5sp">

<android.support.v7.widget.CardView
android:id="@+id/cardViewxx"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:elevation="2dp"

app:cardCornerRadius="2dp">


<LinearLayout
android:id="@+id/defense"
android:layout_width="342dp"
android:layout_height="458dp"
android:layout_gravity="center"
android:background="@android:color/white"
android:orientation="vertical">


<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="238dp">

<TextView
android:id="@+id/scoretestViewxx"
android:layout_width="169dp"
android:layout_height="62dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:gravity="center"
android:onClick="goTobar"
android:text="0"
android:textAllCaps="true"
android:textColor="@android:color/holo_red_dark"
android:textSize="40sp"
android:textStyle="bold"
app:fontFamily="@font/wcmanonegrabta"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"

app:layout_constraintHorizontal_bias="0.502"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.05" />

<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/imagexx"
android:layout_width="140dp"
android:layout_height="141dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:background="@android:color/transparent"
android:scaleType="centerCrop"
app:civ_border_color="#ba000000"
app:civ_border_width="1dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0" />

<ImageView
android:id="@+id/imgRandomxx"
android:layout_width="137dp"
android:layout_height="2dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:layout_weight="1"
android:background="@android:color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.507"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0" />

</android.support.constraint.ConstraintLayout>

<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="199dp"
>

<TextView
android:id="@+id/namexx"
android:layout_width="178dp"
android:layout_height="25dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="8dp"
android:background="@android:color/transparent"
android:gravity="center|left"
android:paddingLeft="20sp"
android:textColor="@android:color/black"
android:textSize="19sp"
app:fontFamily="@font/arsenal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.528"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0"
tools:text="hello" />

<TextView
android:id="@+id/textViewxx"
android:layout_width="140dp"
android:layout_height="28dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:text=" job summery"
android:textColor="@android:color/black"
android:textSize="19sp"
app:fontFamily="@font/arsenal"
app:layout_constraintBottom_toTopOf="@+id/textdiView7xx"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/namexx" />

<TextView
android:id="@+id/textdiView7xx"
android:layout_width="291dp"
android:layout_height="104dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"


android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:ems="10"
android:text="TextView"
android:textColor="@android:color/black"
app:fontFamily="@font/arsenal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.47"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.933" />



</android.support.constraint.ConstraintLayout>

</LinearLayout>
</android.support.v7.widget.CardView>


</LinearLayout>


Arrayadapter



public class arrayAdapterxx extends ArrayAdapter<cardsxx>

Context context;

public arrayAdapterxx(Context context, int resourceId, List<cardsxx> items)
super(context, resourceId, items);

public View getView(int position, View convertView, ViewGroup parent)
cardsxx card_item = getItem(position);

if (convertView == null)
convertView = LayoutInflater.from(getContext()).inflate(R.layout.itemxx, parent, false);



TextView name = (TextView) convertView.findViewById(R.id.namexx);
TextView mytest = (TextView) convertView.findViewById(R.id.scoretestViewxx);
TextView OppsiteDiscription = (TextView) convertView.findViewById(R.id.textdiView7xx);
ImageView image = (ImageView) convertView.findViewById(R.id.imagexx);
ImageView image2 = (ImageView) convertView.findViewById(R.id.imgRandomxx);




name.setText(card_item.getName());
mytest.setText(card_item.getMytest());
OppsiteDiscription.setText(card_item.getOppsiteDiscription());



switch(card_item.getMytest())
case "5":
image2.setImageResource(R.drawable.s_5);
break;
case "10":
image2.setImageResource(R.drawable.s_10);
break;

default:
image2.setImageResource(R.drawable.s_5);
break;



switch(card_item.getProfileImageUrl())
case "default":
Glide.with(convertView.getContext()).load(R.mipmap.ic_launcher).into(image);
break;
default:
Glide.clear(image);
Glide.with(convertView.getContext()).load(card_item.getProfileImageUrl()).into(image);
break;



return convertView;









Card Model



public class cardsxx 
private String userId;
private String name;
private String mytest;
private String OppsiteDiscription;


private String profileImageUrl;

public cardsxx(String userId, String name, String mytest, String OppsiteDiscription, String profileImageUrl)
this.userId = userId;
this.name = name;
this.mytest = mytest;

this.OppsiteDiscription = OppsiteDiscription;

this.profileImageUrl = profileImageUrl;



public String getUserId()
return userId;

public void setUserID(String userID)
this.userId = userId;



public String getName()
return name;

public void setName(String name)
this.name = name;



public String getMytest() return mytest;
public void setMytest(String mytest)

this.mytest = mytest;



public String getOppsiteDiscription() return OppsiteDiscription;
public void setOppsiteDiscription(String OppsiteDiscription) this.OppsiteDiscription = OppsiteDiscription;


public String getProfileImageUrl()

return profileImageUrl;


public void setProfileImageUrl(String profileImageUrl)
this.profileImageUrl = profileImageUrl;







How can i use onclick event in side the adapter to get zoom/ in zoom out ? ..










share|improve this question






















  • ConstraintLayout is a combined linear and relative layout then not used inside linear and it will be parent.

    – Android Team
    Nov 16 '18 at 7:33











  • provide image for design i give correct xml code.

    – Android Team
    Nov 16 '18 at 7:33












  • I have uploaded the image link drive.google.com/open?id=19nEQyEDO9I28qY-Gu-F0be7UP-Oal3B4

    – Indika Dharshana
    Nov 16 '18 at 7:58















0















I need your kind help to guide me to use Zoom in and out the layout in Android CardView via on click .



Card view is connected to arrayadapter.



Also is it possible to do this on ConstraintLayout(ConstraintLayout is in side the LinearLayout?



Card XML



<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@android:color/white"
android:clipToPadding="false"
android:outlineProvider="bounds"
android:paddingBottom="10sp"
android:paddingLeft="15sp"
android:paddingRight="15sp"
android:paddingTop="5sp">

<android.support.v7.widget.CardView
android:id="@+id/cardViewxx"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:elevation="2dp"

app:cardCornerRadius="2dp">


<LinearLayout
android:id="@+id/defense"
android:layout_width="342dp"
android:layout_height="458dp"
android:layout_gravity="center"
android:background="@android:color/white"
android:orientation="vertical">


<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="238dp">

<TextView
android:id="@+id/scoretestViewxx"
android:layout_width="169dp"
android:layout_height="62dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:gravity="center"
android:onClick="goTobar"
android:text="0"
android:textAllCaps="true"
android:textColor="@android:color/holo_red_dark"
android:textSize="40sp"
android:textStyle="bold"
app:fontFamily="@font/wcmanonegrabta"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"

app:layout_constraintHorizontal_bias="0.502"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.05" />

<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/imagexx"
android:layout_width="140dp"
android:layout_height="141dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:background="@android:color/transparent"
android:scaleType="centerCrop"
app:civ_border_color="#ba000000"
app:civ_border_width="1dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0" />

<ImageView
android:id="@+id/imgRandomxx"
android:layout_width="137dp"
android:layout_height="2dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:layout_weight="1"
android:background="@android:color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.507"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0" />

</android.support.constraint.ConstraintLayout>

<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="199dp"
>

<TextView
android:id="@+id/namexx"
android:layout_width="178dp"
android:layout_height="25dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="8dp"
android:background="@android:color/transparent"
android:gravity="center|left"
android:paddingLeft="20sp"
android:textColor="@android:color/black"
android:textSize="19sp"
app:fontFamily="@font/arsenal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.528"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0"
tools:text="hello" />

<TextView
android:id="@+id/textViewxx"
android:layout_width="140dp"
android:layout_height="28dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:text=" job summery"
android:textColor="@android:color/black"
android:textSize="19sp"
app:fontFamily="@font/arsenal"
app:layout_constraintBottom_toTopOf="@+id/textdiView7xx"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/namexx" />

<TextView
android:id="@+id/textdiView7xx"
android:layout_width="291dp"
android:layout_height="104dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"


android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:ems="10"
android:text="TextView"
android:textColor="@android:color/black"
app:fontFamily="@font/arsenal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.47"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.933" />



</android.support.constraint.ConstraintLayout>

</LinearLayout>
</android.support.v7.widget.CardView>


</LinearLayout>


Arrayadapter



public class arrayAdapterxx extends ArrayAdapter<cardsxx>

Context context;

public arrayAdapterxx(Context context, int resourceId, List<cardsxx> items)
super(context, resourceId, items);

public View getView(int position, View convertView, ViewGroup parent)
cardsxx card_item = getItem(position);

if (convertView == null)
convertView = LayoutInflater.from(getContext()).inflate(R.layout.itemxx, parent, false);



TextView name = (TextView) convertView.findViewById(R.id.namexx);
TextView mytest = (TextView) convertView.findViewById(R.id.scoretestViewxx);
TextView OppsiteDiscription = (TextView) convertView.findViewById(R.id.textdiView7xx);
ImageView image = (ImageView) convertView.findViewById(R.id.imagexx);
ImageView image2 = (ImageView) convertView.findViewById(R.id.imgRandomxx);




name.setText(card_item.getName());
mytest.setText(card_item.getMytest());
OppsiteDiscription.setText(card_item.getOppsiteDiscription());



switch(card_item.getMytest())
case "5":
image2.setImageResource(R.drawable.s_5);
break;
case "10":
image2.setImageResource(R.drawable.s_10);
break;

default:
image2.setImageResource(R.drawable.s_5);
break;



switch(card_item.getProfileImageUrl())
case "default":
Glide.with(convertView.getContext()).load(R.mipmap.ic_launcher).into(image);
break;
default:
Glide.clear(image);
Glide.with(convertView.getContext()).load(card_item.getProfileImageUrl()).into(image);
break;



return convertView;









Card Model



public class cardsxx 
private String userId;
private String name;
private String mytest;
private String OppsiteDiscription;


private String profileImageUrl;

public cardsxx(String userId, String name, String mytest, String OppsiteDiscription, String profileImageUrl)
this.userId = userId;
this.name = name;
this.mytest = mytest;

this.OppsiteDiscription = OppsiteDiscription;

this.profileImageUrl = profileImageUrl;



public String getUserId()
return userId;

public void setUserID(String userID)
this.userId = userId;



public String getName()
return name;

public void setName(String name)
this.name = name;



public String getMytest() return mytest;
public void setMytest(String mytest)

this.mytest = mytest;



public String getOppsiteDiscription() return OppsiteDiscription;
public void setOppsiteDiscription(String OppsiteDiscription) this.OppsiteDiscription = OppsiteDiscription;


public String getProfileImageUrl()

return profileImageUrl;


public void setProfileImageUrl(String profileImageUrl)
this.profileImageUrl = profileImageUrl;







How can i use onclick event in side the adapter to get zoom/ in zoom out ? ..










share|improve this question






















  • ConstraintLayout is a combined linear and relative layout then not used inside linear and it will be parent.

    – Android Team
    Nov 16 '18 at 7:33











  • provide image for design i give correct xml code.

    – Android Team
    Nov 16 '18 at 7:33












  • I have uploaded the image link drive.google.com/open?id=19nEQyEDO9I28qY-Gu-F0be7UP-Oal3B4

    – Indika Dharshana
    Nov 16 '18 at 7:58













0












0








0








I need your kind help to guide me to use Zoom in and out the layout in Android CardView via on click .



Card view is connected to arrayadapter.



Also is it possible to do this on ConstraintLayout(ConstraintLayout is in side the LinearLayout?



Card XML



<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@android:color/white"
android:clipToPadding="false"
android:outlineProvider="bounds"
android:paddingBottom="10sp"
android:paddingLeft="15sp"
android:paddingRight="15sp"
android:paddingTop="5sp">

<android.support.v7.widget.CardView
android:id="@+id/cardViewxx"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:elevation="2dp"

app:cardCornerRadius="2dp">


<LinearLayout
android:id="@+id/defense"
android:layout_width="342dp"
android:layout_height="458dp"
android:layout_gravity="center"
android:background="@android:color/white"
android:orientation="vertical">


<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="238dp">

<TextView
android:id="@+id/scoretestViewxx"
android:layout_width="169dp"
android:layout_height="62dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:gravity="center"
android:onClick="goTobar"
android:text="0"
android:textAllCaps="true"
android:textColor="@android:color/holo_red_dark"
android:textSize="40sp"
android:textStyle="bold"
app:fontFamily="@font/wcmanonegrabta"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"

app:layout_constraintHorizontal_bias="0.502"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.05" />

<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/imagexx"
android:layout_width="140dp"
android:layout_height="141dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:background="@android:color/transparent"
android:scaleType="centerCrop"
app:civ_border_color="#ba000000"
app:civ_border_width="1dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0" />

<ImageView
android:id="@+id/imgRandomxx"
android:layout_width="137dp"
android:layout_height="2dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:layout_weight="1"
android:background="@android:color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.507"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0" />

</android.support.constraint.ConstraintLayout>

<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="199dp"
>

<TextView
android:id="@+id/namexx"
android:layout_width="178dp"
android:layout_height="25dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="8dp"
android:background="@android:color/transparent"
android:gravity="center|left"
android:paddingLeft="20sp"
android:textColor="@android:color/black"
android:textSize="19sp"
app:fontFamily="@font/arsenal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.528"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0"
tools:text="hello" />

<TextView
android:id="@+id/textViewxx"
android:layout_width="140dp"
android:layout_height="28dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:text=" job summery"
android:textColor="@android:color/black"
android:textSize="19sp"
app:fontFamily="@font/arsenal"
app:layout_constraintBottom_toTopOf="@+id/textdiView7xx"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/namexx" />

<TextView
android:id="@+id/textdiView7xx"
android:layout_width="291dp"
android:layout_height="104dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"


android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:ems="10"
android:text="TextView"
android:textColor="@android:color/black"
app:fontFamily="@font/arsenal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.47"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.933" />



</android.support.constraint.ConstraintLayout>

</LinearLayout>
</android.support.v7.widget.CardView>


</LinearLayout>


Arrayadapter



public class arrayAdapterxx extends ArrayAdapter<cardsxx>

Context context;

public arrayAdapterxx(Context context, int resourceId, List<cardsxx> items)
super(context, resourceId, items);

public View getView(int position, View convertView, ViewGroup parent)
cardsxx card_item = getItem(position);

if (convertView == null)
convertView = LayoutInflater.from(getContext()).inflate(R.layout.itemxx, parent, false);



TextView name = (TextView) convertView.findViewById(R.id.namexx);
TextView mytest = (TextView) convertView.findViewById(R.id.scoretestViewxx);
TextView OppsiteDiscription = (TextView) convertView.findViewById(R.id.textdiView7xx);
ImageView image = (ImageView) convertView.findViewById(R.id.imagexx);
ImageView image2 = (ImageView) convertView.findViewById(R.id.imgRandomxx);




name.setText(card_item.getName());
mytest.setText(card_item.getMytest());
OppsiteDiscription.setText(card_item.getOppsiteDiscription());



switch(card_item.getMytest())
case "5":
image2.setImageResource(R.drawable.s_5);
break;
case "10":
image2.setImageResource(R.drawable.s_10);
break;

default:
image2.setImageResource(R.drawable.s_5);
break;



switch(card_item.getProfileImageUrl())
case "default":
Glide.with(convertView.getContext()).load(R.mipmap.ic_launcher).into(image);
break;
default:
Glide.clear(image);
Glide.with(convertView.getContext()).load(card_item.getProfileImageUrl()).into(image);
break;



return convertView;









Card Model



public class cardsxx 
private String userId;
private String name;
private String mytest;
private String OppsiteDiscription;


private String profileImageUrl;

public cardsxx(String userId, String name, String mytest, String OppsiteDiscription, String profileImageUrl)
this.userId = userId;
this.name = name;
this.mytest = mytest;

this.OppsiteDiscription = OppsiteDiscription;

this.profileImageUrl = profileImageUrl;



public String getUserId()
return userId;

public void setUserID(String userID)
this.userId = userId;



public String getName()
return name;

public void setName(String name)
this.name = name;



public String getMytest() return mytest;
public void setMytest(String mytest)

this.mytest = mytest;



public String getOppsiteDiscription() return OppsiteDiscription;
public void setOppsiteDiscription(String OppsiteDiscription) this.OppsiteDiscription = OppsiteDiscription;


public String getProfileImageUrl()

return profileImageUrl;


public void setProfileImageUrl(String profileImageUrl)
this.profileImageUrl = profileImageUrl;







How can i use onclick event in side the adapter to get zoom/ in zoom out ? ..










share|improve this question














I need your kind help to guide me to use Zoom in and out the layout in Android CardView via on click .



Card view is connected to arrayadapter.



Also is it possible to do this on ConstraintLayout(ConstraintLayout is in side the LinearLayout?



Card XML



<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@android:color/white"
android:clipToPadding="false"
android:outlineProvider="bounds"
android:paddingBottom="10sp"
android:paddingLeft="15sp"
android:paddingRight="15sp"
android:paddingTop="5sp">

<android.support.v7.widget.CardView
android:id="@+id/cardViewxx"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:elevation="2dp"

app:cardCornerRadius="2dp">


<LinearLayout
android:id="@+id/defense"
android:layout_width="342dp"
android:layout_height="458dp"
android:layout_gravity="center"
android:background="@android:color/white"
android:orientation="vertical">


<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="238dp">

<TextView
android:id="@+id/scoretestViewxx"
android:layout_width="169dp"
android:layout_height="62dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:gravity="center"
android:onClick="goTobar"
android:text="0"
android:textAllCaps="true"
android:textColor="@android:color/holo_red_dark"
android:textSize="40sp"
android:textStyle="bold"
app:fontFamily="@font/wcmanonegrabta"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"

app:layout_constraintHorizontal_bias="0.502"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.05" />

<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/imagexx"
android:layout_width="140dp"
android:layout_height="141dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:background="@android:color/transparent"
android:scaleType="centerCrop"
app:civ_border_color="#ba000000"
app:civ_border_width="1dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0" />

<ImageView
android:id="@+id/imgRandomxx"
android:layout_width="137dp"
android:layout_height="2dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:layout_weight="1"
android:background="@android:color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.507"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="1.0" />

</android.support.constraint.ConstraintLayout>

<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="199dp"
>

<TextView
android:id="@+id/namexx"
android:layout_width="178dp"
android:layout_height="25dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="8dp"
android:background="@android:color/transparent"
android:gravity="center|left"
android:paddingLeft="20sp"
android:textColor="@android:color/black"
android:textSize="19sp"
app:fontFamily="@font/arsenal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.528"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0"
tools:text="hello" />

<TextView
android:id="@+id/textViewxx"
android:layout_width="140dp"
android:layout_height="28dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:text=" job summery"
android:textColor="@android:color/black"
android:textSize="19sp"
app:fontFamily="@font/arsenal"
app:layout_constraintBottom_toTopOf="@+id/textdiView7xx"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/namexx" />

<TextView
android:id="@+id/textdiView7xx"
android:layout_width="291dp"
android:layout_height="104dp"
android:layout_marginStart="8dp"
android:layout_marginLeft="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"


android:layout_marginRight="8dp"
android:layout_marginBottom="8dp"
android:ems="10"
android:text="TextView"
android:textColor="@android:color/black"
app:fontFamily="@font/arsenal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.47"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.933" />



</android.support.constraint.ConstraintLayout>

</LinearLayout>
</android.support.v7.widget.CardView>


</LinearLayout>


Arrayadapter



public class arrayAdapterxx extends ArrayAdapter<cardsxx>

Context context;

public arrayAdapterxx(Context context, int resourceId, List<cardsxx> items)
super(context, resourceId, items);

public View getView(int position, View convertView, ViewGroup parent)
cardsxx card_item = getItem(position);

if (convertView == null)
convertView = LayoutInflater.from(getContext()).inflate(R.layout.itemxx, parent, false);



TextView name = (TextView) convertView.findViewById(R.id.namexx);
TextView mytest = (TextView) convertView.findViewById(R.id.scoretestViewxx);
TextView OppsiteDiscription = (TextView) convertView.findViewById(R.id.textdiView7xx);
ImageView image = (ImageView) convertView.findViewById(R.id.imagexx);
ImageView image2 = (ImageView) convertView.findViewById(R.id.imgRandomxx);




name.setText(card_item.getName());
mytest.setText(card_item.getMytest());
OppsiteDiscription.setText(card_item.getOppsiteDiscription());



switch(card_item.getMytest())
case "5":
image2.setImageResource(R.drawable.s_5);
break;
case "10":
image2.setImageResource(R.drawable.s_10);
break;

default:
image2.setImageResource(R.drawable.s_5);
break;



switch(card_item.getProfileImageUrl())
case "default":
Glide.with(convertView.getContext()).load(R.mipmap.ic_launcher).into(image);
break;
default:
Glide.clear(image);
Glide.with(convertView.getContext()).load(card_item.getProfileImageUrl()).into(image);
break;



return convertView;









Card Model



public class cardsxx 
private String userId;
private String name;
private String mytest;
private String OppsiteDiscription;


private String profileImageUrl;

public cardsxx(String userId, String name, String mytest, String OppsiteDiscription, String profileImageUrl)
this.userId = userId;
this.name = name;
this.mytest = mytest;

this.OppsiteDiscription = OppsiteDiscription;

this.profileImageUrl = profileImageUrl;



public String getUserId()
return userId;

public void setUserID(String userID)
this.userId = userId;



public String getName()
return name;

public void setName(String name)
this.name = name;



public String getMytest() return mytest;
public void setMytest(String mytest)

this.mytest = mytest;



public String getOppsiteDiscription() return OppsiteDiscription;
public void setOppsiteDiscription(String OppsiteDiscription) this.OppsiteDiscription = OppsiteDiscription;


public String getProfileImageUrl()

return profileImageUrl;


public void setProfileImageUrl(String profileImageUrl)
this.profileImageUrl = profileImageUrl;







How can i use onclick event in side the adapter to get zoom/ in zoom out ? ..







android android-layout arraylist zoom android-cardview






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 16 '18 at 6:48









Indika DharshanaIndika Dharshana

26




26












  • ConstraintLayout is a combined linear and relative layout then not used inside linear and it will be parent.

    – Android Team
    Nov 16 '18 at 7:33











  • provide image for design i give correct xml code.

    – Android Team
    Nov 16 '18 at 7:33












  • I have uploaded the image link drive.google.com/open?id=19nEQyEDO9I28qY-Gu-F0be7UP-Oal3B4

    – Indika Dharshana
    Nov 16 '18 at 7:58

















  • ConstraintLayout is a combined linear and relative layout then not used inside linear and it will be parent.

    – Android Team
    Nov 16 '18 at 7:33











  • provide image for design i give correct xml code.

    – Android Team
    Nov 16 '18 at 7:33












  • I have uploaded the image link drive.google.com/open?id=19nEQyEDO9I28qY-Gu-F0be7UP-Oal3B4

    – Indika Dharshana
    Nov 16 '18 at 7:58
















ConstraintLayout is a combined linear and relative layout then not used inside linear and it will be parent.

– Android Team
Nov 16 '18 at 7:33





ConstraintLayout is a combined linear and relative layout then not used inside linear and it will be parent.

– Android Team
Nov 16 '18 at 7:33













provide image for design i give correct xml code.

– Android Team
Nov 16 '18 at 7:33






provide image for design i give correct xml code.

– Android Team
Nov 16 '18 at 7:33














I have uploaded the image link drive.google.com/open?id=19nEQyEDO9I28qY-Gu-F0be7UP-Oal3B4

– Indika Dharshana
Nov 16 '18 at 7:58





I have uploaded the image link drive.google.com/open?id=19nEQyEDO9I28qY-Gu-F0be7UP-Oal3B4

– Indika Dharshana
Nov 16 '18 at 7:58












1 Answer
1






active

oldest

votes


















0














if( // wants to zoom)
view.animate().scaleX(1.05f).scaleY(1.05f).setDuration(135);
else // stay there
view.animate().scaleX(1).scaleY(1).setDuration(135);





share|improve this answer























  • is this can be use in side the Arrayadapter ?

    – Indika Dharshana
    Nov 16 '18 at 8:02












  • yes. You need to get a view. Then apply this piece of code

    – Rehman Murad Ali
    Nov 18 '18 at 7:47











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53332766%2fhow-to-zoom-in-and-out-layout-in-android-cardview%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














if( // wants to zoom)
view.animate().scaleX(1.05f).scaleY(1.05f).setDuration(135);
else // stay there
view.animate().scaleX(1).scaleY(1).setDuration(135);





share|improve this answer























  • is this can be use in side the Arrayadapter ?

    – Indika Dharshana
    Nov 16 '18 at 8:02












  • yes. You need to get a view. Then apply this piece of code

    – Rehman Murad Ali
    Nov 18 '18 at 7:47















0














if( // wants to zoom)
view.animate().scaleX(1.05f).scaleY(1.05f).setDuration(135);
else // stay there
view.animate().scaleX(1).scaleY(1).setDuration(135);





share|improve this answer























  • is this can be use in side the Arrayadapter ?

    – Indika Dharshana
    Nov 16 '18 at 8:02












  • yes. You need to get a view. Then apply this piece of code

    – Rehman Murad Ali
    Nov 18 '18 at 7:47













0












0








0







if( // wants to zoom)
view.animate().scaleX(1.05f).scaleY(1.05f).setDuration(135);
else // stay there
view.animate().scaleX(1).scaleY(1).setDuration(135);





share|improve this answer













if( // wants to zoom)
view.animate().scaleX(1.05f).scaleY(1.05f).setDuration(135);
else // stay there
view.animate().scaleX(1).scaleY(1).setDuration(135);






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 16 '18 at 7:42









Rehman Murad AliRehman Murad Ali

274




274












  • is this can be use in side the Arrayadapter ?

    – Indika Dharshana
    Nov 16 '18 at 8:02












  • yes. You need to get a view. Then apply this piece of code

    – Rehman Murad Ali
    Nov 18 '18 at 7:47

















  • is this can be use in side the Arrayadapter ?

    – Indika Dharshana
    Nov 16 '18 at 8:02












  • yes. You need to get a view. Then apply this piece of code

    – Rehman Murad Ali
    Nov 18 '18 at 7:47
















is this can be use in side the Arrayadapter ?

– Indika Dharshana
Nov 16 '18 at 8:02






is this can be use in side the Arrayadapter ?

– Indika Dharshana
Nov 16 '18 at 8:02














yes. You need to get a view. Then apply this piece of code

– Rehman Murad Ali
Nov 18 '18 at 7:47





yes. You need to get a view. Then apply this piece of code

– Rehman Murad Ali
Nov 18 '18 at 7:47



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53332766%2fhow-to-zoom-in-and-out-layout-in-android-cardview%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Top Tejano songwriter Luis Silva dead of heart attack at 64

政党

天津地下鉄3号線