Norway


ImageView with aspect ratio and orientation

-  - The Android Arsenal – Image Views

Installation

implementation 'com.litedevs:oriented--view:1.0'

Example

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:="http://schemas..com/apk/res/"
    :layout_width="match_parent"
    :layout_height="match_parent"
    :orientation="vertical">

    <!--With Fixed Width -->

    <!-- Aspect Ratio 16:9 -->
    <com.litedevs.view.OrientedImageView
        xmlns:="http://schemas..com/apk/res-auto"
        :layout_width="match_parent"
        :layout_height="wrap_content"
        :src="http://-.com/@:color/holo_red_light"
        app:fixedOrientation="horizontal"
        app:aspectRatio="1.77">
    </com.litedevs.view.OrientedImageView>


    <!--With Fixed Height -->
    <!-- Aspect Ratio 2:3 -->
    <com.litedevs.view.OrientedImageView
        xmlns:app="http://schemas..com/apk/res-auto"
        :layout_width="wrap_content"
        :layout_height="match_parent"
        :src="@:color/holo_blue_bright"
        app:fixedOrientation="vertical"
        app:aspectRatio="0.67">
        
    </com.litedevs.view.OrientedImageView>
</LinearLayout>

Sample Screenshot

-  - The Android Arsenal &#8211; Image Views

Licence

Copyright Rahul Kumar

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.



Source link

LEAVE A REPLY

Please enter your comment!
Please enter your name here