How to draw angled rectangle as background for ViewPager android [closed]
up vote
0
down vote
favorite
I want to implement a ViewPager as shown in the image. I have tried to get it done by setting xml as background. But it only displays properly if we give image in that xml itself and if I try to manage it runtime then it is not taking that angled background.
This is the drawable I have attached to custom viewpager layout
</item>-->
<item android:top="300dp"
android:bottom="-300dp"
android:left="0dp"
android:right="-300dp">
<rotate
android:fromDegrees="-10"
android:pivotX="0%"
android:pivotY="100%">
<shape
android:shape="rectangle">
<solid
android:color="@color/white"/>
</shape>
</rotate>
</item>
AND this is the custom viewpager layout
<RelativeLayout
android:id="@+id/rl_image"
android:layout_width="match_parent"
android:layout_height="300dp"
android:background="@drawable/custom_imageview">
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/rl_image"
android:layout_marginLeft="20dp"
android:layout_marginTop="-60dp">
<de.hdodenhof.circleimageview.CircleImageView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/profile_image"
android:layout_width="70dp"
android:layout_height="70dp"
android:src="@drawable/fashion1"
app:civ_border_color="#FFF"
app:civ_border_width="1dp" />
<android.support.design.widget.TabLayout
android:id="@+id/tl_custom_viewpager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
app:tabBackground="@drawable/tab_selector"
app:tabGravity="center"
app:tabIndicatorHeight="0dp" />
</RelativeLayout>
Can anyone please tell me how to implement it.

xml java android
closed as off-topic by Romain Picot, Andrew, Circumscribe, Phelype Oleinik, samcarter Dec 7 at 9:57
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center." – Romain Picot, Andrew, Circumscribe, Phelype Oleinik, samcarter
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
up vote
0
down vote
favorite
I want to implement a ViewPager as shown in the image. I have tried to get it done by setting xml as background. But it only displays properly if we give image in that xml itself and if I try to manage it runtime then it is not taking that angled background.
This is the drawable I have attached to custom viewpager layout
</item>-->
<item android:top="300dp"
android:bottom="-300dp"
android:left="0dp"
android:right="-300dp">
<rotate
android:fromDegrees="-10"
android:pivotX="0%"
android:pivotY="100%">
<shape
android:shape="rectangle">
<solid
android:color="@color/white"/>
</shape>
</rotate>
</item>
AND this is the custom viewpager layout
<RelativeLayout
android:id="@+id/rl_image"
android:layout_width="match_parent"
android:layout_height="300dp"
android:background="@drawable/custom_imageview">
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/rl_image"
android:layout_marginLeft="20dp"
android:layout_marginTop="-60dp">
<de.hdodenhof.circleimageview.CircleImageView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/profile_image"
android:layout_width="70dp"
android:layout_height="70dp"
android:src="@drawable/fashion1"
app:civ_border_color="#FFF"
app:civ_border_width="1dp" />
<android.support.design.widget.TabLayout
android:id="@+id/tl_custom_viewpager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
app:tabBackground="@drawable/tab_selector"
app:tabGravity="center"
app:tabIndicatorHeight="0dp" />
</RelativeLayout>
Can anyone please tell me how to implement it.

xml java android
closed as off-topic by Romain Picot, Andrew, Circumscribe, Phelype Oleinik, samcarter Dec 7 at 9:57
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center." – Romain Picot, Andrew, Circumscribe, Phelype Oleinik, samcarter
If this question can be reworded to fit the rules in the help center, please edit the question.
1
I think you've posted to the wrong site!? TeX.SX is for questions about TeX.
– Andrew
Dec 7 at 9:44
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I want to implement a ViewPager as shown in the image. I have tried to get it done by setting xml as background. But it only displays properly if we give image in that xml itself and if I try to manage it runtime then it is not taking that angled background.
This is the drawable I have attached to custom viewpager layout
</item>-->
<item android:top="300dp"
android:bottom="-300dp"
android:left="0dp"
android:right="-300dp">
<rotate
android:fromDegrees="-10"
android:pivotX="0%"
android:pivotY="100%">
<shape
android:shape="rectangle">
<solid
android:color="@color/white"/>
</shape>
</rotate>
</item>
AND this is the custom viewpager layout
<RelativeLayout
android:id="@+id/rl_image"
android:layout_width="match_parent"
android:layout_height="300dp"
android:background="@drawable/custom_imageview">
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/rl_image"
android:layout_marginLeft="20dp"
android:layout_marginTop="-60dp">
<de.hdodenhof.circleimageview.CircleImageView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/profile_image"
android:layout_width="70dp"
android:layout_height="70dp"
android:src="@drawable/fashion1"
app:civ_border_color="#FFF"
app:civ_border_width="1dp" />
<android.support.design.widget.TabLayout
android:id="@+id/tl_custom_viewpager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
app:tabBackground="@drawable/tab_selector"
app:tabGravity="center"
app:tabIndicatorHeight="0dp" />
</RelativeLayout>
Can anyone please tell me how to implement it.

xml java android
I want to implement a ViewPager as shown in the image. I have tried to get it done by setting xml as background. But it only displays properly if we give image in that xml itself and if I try to manage it runtime then it is not taking that angled background.
This is the drawable I have attached to custom viewpager layout
</item>-->
<item android:top="300dp"
android:bottom="-300dp"
android:left="0dp"
android:right="-300dp">
<rotate
android:fromDegrees="-10"
android:pivotX="0%"
android:pivotY="100%">
<shape
android:shape="rectangle">
<solid
android:color="@color/white"/>
</shape>
</rotate>
</item>
AND this is the custom viewpager layout
<RelativeLayout
android:id="@+id/rl_image"
android:layout_width="match_parent"
android:layout_height="300dp"
android:background="@drawable/custom_imageview">
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/rl_image"
android:layout_marginLeft="20dp"
android:layout_marginTop="-60dp">
<de.hdodenhof.circleimageview.CircleImageView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/profile_image"
android:layout_width="70dp"
android:layout_height="70dp"
android:src="@drawable/fashion1"
app:civ_border_color="#FFF"
app:civ_border_width="1dp" />
<android.support.design.widget.TabLayout
android:id="@+id/tl_custom_viewpager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
app:tabBackground="@drawable/tab_selector"
app:tabGravity="center"
app:tabIndicatorHeight="0dp" />
</RelativeLayout>
Can anyone please tell me how to implement it.

xml java android
xml java android
asked Dec 7 at 9:29
user176314
closed as off-topic by Romain Picot, Andrew, Circumscribe, Phelype Oleinik, samcarter Dec 7 at 9:57
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center." – Romain Picot, Andrew, Circumscribe, Phelype Oleinik, samcarter
If this question can be reworded to fit the rules in the help center, please edit the question.
closed as off-topic by Romain Picot, Andrew, Circumscribe, Phelype Oleinik, samcarter Dec 7 at 9:57
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center." – Romain Picot, Andrew, Circumscribe, Phelype Oleinik, samcarter
If this question can be reworded to fit the rules in the help center, please edit the question.
1
I think you've posted to the wrong site!? TeX.SX is for questions about TeX.
– Andrew
Dec 7 at 9:44
add a comment |
1
I think you've posted to the wrong site!? TeX.SX is for questions about TeX.
– Andrew
Dec 7 at 9:44
1
1
I think you've posted to the wrong site!? TeX.SX is for questions about TeX.
– Andrew
Dec 7 at 9:44
I think you've posted to the wrong site!? TeX.SX is for questions about TeX.
– Andrew
Dec 7 at 9:44
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
1
I think you've posted to the wrong site!? TeX.SX is for questions about TeX.
– Andrew
Dec 7 at 9:44