2015-05-10 2 views
0

Я пытаюсь создать круговое изображение и использовать все библиотеки, доступные в данный момент на github. В конце концов, я попытался это решение:Изображение не подходит для просмотра круглых изображений

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    tools:context=".CompanyActivity" 
    android:background="@drawable/background"> 

    <ScrollView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:clickable="true"> 

      <com.example.bydlokoder.empatika.utils.BezelImageView 
       xmlns:app="http://schemas.android.com/apk/res-auto" 
       android:id="@+id/logo" 
       android:layout_width="@dimen/logo_width" 
       android:layout_height="@dimen/logo_height" 
       android:scaleType="fitCenter" 
       android:adjustViewBounds="true" 
       android:src="@mipmap/ic_launcher" 
       android:layout_centerHorizontal="true" 
       android:clickable="false" 
       android:elevation="1dp" 
       app:biv_maskDrawable="@drawable/circle_mask" 
       /> 


      <TextView 
       android:id="@+id/company_name" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/logo" 
       android:layout_centerHorizontal="true" 
       android:layout_marginTop="@dimen/activity_vertical_margin" 
       android:fontFamily="sans-serif-light" 
       android:text="@string/company_name" 
       android:textColor="@android:color/white" 
       android:textSize="@dimen/company_name_text_size" 
       android:textStyle="bold" /> 

      <TextView 
       android:id="@+id/company_description" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/company_name" 
       android:layout_marginTop="@dimen/activity_doubled_vertical_margin" 
       android:fontFamily="sans-serif-light" 
       android:text="@string/company_description" 
       android:textColor="@android:color/white" 
       android:textSize="@dimen/company_description_text_size" 
       android:layout_centerHorizontal="true"/> 

      <Button 
       android:id="@+id/call_button" 
       android:layout_width="@dimen/button_width" 
       android:layout_height="@dimen/button_height" 
       android:layout_below="@+id/company_description" 
       android:layout_centerHorizontal="true" 
       android:layout_marginTop="@dimen/activity_doubled_vertical_margin" 
       android:background="@drawable/button_style" 
       android:drawableLeft="@android:drawable/ic_menu_call" 
       android:fontFamily="sans-serif-light" 
       android:textStyle="bold" 
       android:paddingLeft="@dimen/button_left_padding" 
       android:text="@string/call_button" 
       android:textSize="@dimen/button_text_size" /> 

      <Button 
       android:id="@+id/email_button" 
       android:layout_width="@dimen/button_width" 
       android:layout_height="@dimen/button_height" 
       android:layout_below="@+id/call_button" 
       android:layout_centerHorizontal="true" 
       android:layout_marginTop="@dimen/activity_vertical_margin" 
       android:background="@drawable/button_style" 
       android:drawableLeft="@android:drawable/ic_dialog_email" 
       android:fontFamily="sans-serif-light" 
       android:textStyle="bold" 
       android:paddingLeft="@dimen/button_left_padding" 
       android:text="@string/email_button" 
       android:textSize="@dimen/button_text_size" /> 

      <TextView 
       android:id="@+id/copyright" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/email_button" 
       android:layout_centerHorizontal="true" 
       android:layout_marginTop="@dimen/activity_doubled_vertical_margin" 
       android:text="@string/company_copyright" 
       android:textColor="@android:color/white" 
       android:textSize="@dimen/company_copyright_text_size" /> 
     </RelativeLayout> 
    </ScrollView> 

</RelativeLayout> 

Bit это дает мне тот же образ, который не выглядит хорошо bad icon

Я думаю, что Google должен предоставить стандартную точку зрения для этой цели ... Любой идеи, как это решить?

класса Java можно найти там BezelImageView

+0

Добавить белую рамку вокруг изображения или сделать круг меньше. –

ответ

0

Сделайте круговые изображения в прозрачном/альфа области площади изображения. Нет необходимости иметь круговое изображение таким образом. Просто пример ниже (сохранить в формате PNG с альфа/прозрачностью)

http://dfoolonthehill.com/wp-content/uploads/2010/06/ScreenHunter_16-Jun.-13-19.21.jpg

+0

Вы могли бы привести пример? –

+0

Вы можете отредактировать код пользовательского изображения, а также вычислить и масштабировать растровое изображение на методе draw, где он будет рисовать холст. – RBK

0

Это только из-за ImageView не поддерживать масштабный тип, он просто нарисовать свой растровый холст с маскировкой. Вот почему изображение не подходит для просмотра изображений.

+0

как насчет решения? –