Popular post layout in android studio

 Collection of attractive layout :


<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"

xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_margin="@dimen/dimens_4dp"
app:cardCornerRadius="@dimen/margin_equal">
<LinearLayout
android:layout_width="match_parent"
android:id="@+id/card"
android:layout_height="wrap_content"
android:orientation="horizontal">


<RelativeLayout
android:layout_width="@dimen/dimens_120dp"
android:layout_height="@dimen/dimens_100dp">

<ImageView
android:id="@+id/blogTitleImage"
android:layout_width="@dimen/dimens_120dp"
android:layout_height="@dimen/dimens_100dp"
android:scaleType="fitXY"
android:src="@drawable/twitter">

</ImageView>

<TextView
android:id="@+id/rank2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/rank_background"
android:drawableLeft="@drawable/hez_24"

android:drawableTint="@color/white"
android:paddingLeft="@dimen/margin_equal"
android:paddingRight="@dimen/margin_msixteen"
android:text="1"
android:textColor="@color/white"
android:textSize="@dimen/font_large">

</TextView>

</RelativeLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginLeft="@dimen/margin_foure"
android:layout_marginRight="@dimen/margin_foure"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/BlogProductShortDescription"
android:layout_marginTop="@dimen/margin_equal"
android:text="in order to change the colours of the stars in the RatingBar. I followed the posts and was able to change the stars for the custom RatingBar, but in doing this I was no longer able to set the value to be a decimal lower"
android:textSize="@dimen/font_large"
android:maxLines="3"
android:textColor="@color/black">

</TextView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/productdateTextView"
android:layout_marginBottom="@dimen/margin_equal"
android:maxLength="10"
android:textSize="@dimen/font_small"
android:layout_marginTop="8dp"
android:text="PopulerPostLayout ">

</TextView>


</LinearLayout>


</LinearLayout>
</androidx.cardview.widget.CardView>
Code for rank_background :put on draible :
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">

<!-- view background color -->
<solid
android:color="#CC0001" >
</solid>

<!-- view border color and width -->


<!-- If you want to add some padding -->
<corners
android:bottomRightRadius="20dp">
</corners>

<!-- Here is the corner radius -->


</shape>
Background style image is given Below :


Rajeshbhatt12

My name is Rajesh Bhatt. I am working as a senior android developer . I have created this blog for kotlin ,java and Android Development interview questions etc..

Previous Post Next Post