四舍五入的意见角落在记事本的Andr​​oid应用 [英] Rounding the corners of views in notepad android app

查看:236
本文介绍了四舍五入的意见角落在记事本的Andr​​oid应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我有这个用户界面上我的应用程序。

I currently have this user interface on my app.

在这里输入的形象描述

我想圆音符的边缘像我设法在应用程序的组成部分做的,如下

I would like to round the edges of the notes like I managed to do in the composing section of the app, as below

在这里输入的形象描述

我是能够通过使用在一个文件中的以下在提拉所谓timetable_item_border.xml要做到这一点,

I was able to do this by using the following in a file in drawable called timetable_item_border.xml,

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" >

    <stroke
        android:width="0dp"
        android:color="#000" />

    <solid android:color="@color/tile_background" />

    <padding
        android:bottom="@dimen/tile_padding"
        android:left="@dimen/tile_padding"
        android:right="@dimen/tile_padding"
        android:top="@dimen/tile_padding" />
    <!-- <corners android:radius="1dp" /> -->
    <corners android:radius="10dp"/>

</shape>

我试图运用机器人:背景:@绘制/ timetable_item_border在以下文件的开始,但它弯曲的音符,但边角全部拆除填充,这是我没有想。 (我把它的框架布局的开始,但之前的线性布局)。

I tried to apply android:background:@drawable/timetable_item_border at the start of the following file but it curved the corners of the notes but removed all the padding, which I didnt want. (I put it at the start of the frame layout but before the linear layout).

这是文件:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/root"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="@dimen/note_tile_margin">

    <LinearLayout
        android:id="@+id/tile_clickable"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:animateLayoutChanges="true"
        android:background="@drawable/tile_selector"
        android:clickable="true"
        android:orientation="vertical">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >

            <TextView
                android:id="@+id/noteTitle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_alignParentTop="true"
                android:layout_margin="@dimen/tile_padding"
                android:layout_toLeftOf="@+id/btn_tile_expand"
                android:ellipsize="end"
                android:maxLines="@integer/max_tile_lines"
                android:singleLine="false"
                android:text="Write your message here... "
                android:textColor="@color/tile_text" />

            <LinearLayout
                android:id="@+id/btn_tile_expand"
                android:layout_width="wrap_content"
                android:layout_height="fill_parent"
                android:layout_alignParentRight="true"
                android:layout_alignParentTop="true"
                android:background="@drawable/click_selector"
                android:gravity="top" >

                <ImageView
                    android:id="@+id/btn_tile_menu"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:padding="7dp"
                    android:src="@drawable/icon_dark_expand" />
            </LinearLayout>
        </RelativeLayout>

        <LinearLayout
            android:id="@+id/tile_options"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="right"
            android:gravity="right"
            android:visibility="gone" >

            <ImageView
                android:id="@+id/btn_tile_links"
                style="@style/btn_tile_option"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:clickable="true"
                android:contentDescription="Hyperlinks"
                android:src="@drawable/icon_dark_web" />

            <ImageView
                android:id="@+id/btn_tile_delete"
                style="@style/btn_tile_option"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:clickable="true"
                android:contentDescription="@string/deleteNote"
                android:src="@drawable/icon_dark_delete" />

            <ImageView
                android:id="@+id/btn_tile_share"
                style="@style/btn_tile_option"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:clickable="true"
                android:contentDescription="@string/share"
                android:src="@drawable/icon_dark_share" />

            <ImageView
                android:id="@+id/btn_tile_copy"
                style="@style/btn_tile_option"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:clickable="true"
                android:contentDescription="Copy to clipboard"
                android:src="@drawable/icon_dark_copy" />
        </LinearLayout>
    </LinearLayout>

</FrameLayout>

我应该怎样曲线的音符?什么是我不能正常看到?

How should I curve the notes? What am I not seeing correctly?

注:原源$ C ​​$ C来自这里, https://github.com/mick88/notepad ,我只是重做图形。

Note: The original source code comes from here, https://github.com/mick88/notepad, I am just redoing the graphics.

推荐答案

谷歌已经创造了这个非常情况的图。该CardView http://developer.android.com/training/material/lists-cards html的

Google have created a view for this very case. The CardView http://developer.android.com/training/material/lists-cards.html

这篇关于四舍五入的意见角落在记事本的Andr​​oid应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆