I have the following layout:
Each of the Pokemon Team rows has a fixed size of 100dp :
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/pokemonTeambuilderContainer"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/pokemonTeambuilderTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/untitled"
android:textSize="16sp"
android:textStyle="bold" />
<LinearLayout
android:id="@+id/pokemonTeambuilderSpritesLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="horizontal" />
</LinearLayout>
</androidx.cardview.widget.CardView>
The Pokemon inside each row are image view created in this adapter :
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
PokemonTeam pokemonTeam = mData.get(position);
for (Pokemon pokemon : pokemonTeam.getPokemonList()) {
CircularImageView ivPokemonSprite = new CircularImageView(mContext);
int color = PokemonUtils.getDominantColorFromPokemon(pokemon.get_id(), mContext);
ivPokemonSprite.setBorderColor(color);
ivPokemonSprite.setBorderWidth(4);
ivPokemonSprite.setCircleColor(PokemonUtils.lighterColor(color, DARK_FACTOR));
Picasso.get().load(PokemonUtils.getPokemonSugimoriImageById(pokemon.get_id(), mContext)).fit().centerCrop().into(ivPokemonSprite);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT, 1);
layoutParams.setMargins(3, 10, 3, 10);
ivPokemonSprite.setLayoutParams(layoutParams);
holder.teamSpritesLinearLayout.addView(ivPokemonSprite);
}
String pokemonTeamName = pokemonTeam.getName();
if (pokemonTeamName != null && !pokemonTeamName.isEmpty()) {
holder.teamTitleTextView.setText(pokemonTeam.getName());
}
}
My problem is when I rotate the device :
I would like to have at least 200dp of height in order to make each row bigger (otherwise I think that in devices like Tablet it will look very small), like this :