小编But*_*fly的帖子

创建带圆角的三角形

我需要创建带圆角的三角形.这是我的代码

<item android:gravity="center">
    <rotate
        android:fromDegrees="45"
        android:pivotX="-40%"
        android:pivotY="87%"
        android:toDegrees="45" >
        <shape android:shape="rectangle" >
            <corners android:radius="2dp"/>
            <solid android:color="#ffffff" >
            </solid>

            <stroke
                android:color="#ffffff" />

        </shape>

    </rotate>
</item>
Run Code Online (Sandbox Code Playgroud)

我的代码只有三角形的一边是圆形的,另外两个角没有圆角.请帮我创建三角形的圆角.

android shape draw

7
推荐指数
1
解决办法
2300
查看次数

在drawable中绘制工具提示

我想在我的按钮上添加工具提示.有没有简单的方法来做到这一点.我想绘制形状.但我只找到带有绘图视图的方法或建议添加lib.是否可以绘制工具提示(使用xml制作工具提示)?

android shape drawable

2
推荐指数
2
解决办法
2164
查看次数

禁用 Edittext 后启用它

OnButtonClick 侦听器 我想禁用 EditText 进行编辑,然后再次打开它。

在下面两行中,我禁用了 EditText

 editTextWight.setEnabled(false);
 editTextWight.setFocusable(false);
Run Code Online (Sandbox Code Playgroud)

但是当我试图把它转回来时失败了。键盘打不开。

editTextWight.setFocusable(true);
editTextWight.setFocusableInTouchMode(true);
editTextWight.setClickable(true);
editTextWight.setEnabled(true);
Run Code Online (Sandbox Code Playgroud)

请帮我启用EditText。

android android-edittext

2
推荐指数
1
解决办法
2346
查看次数

将前景设置为imageview

我将前景设置为我的imageview以选择何时被选中.这在android 6版本中运行良好.在选择最小版本时没有任何变化.请帮我.

<ImageView
        android:id="@+id/style_list_item_image_view"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:adjustViewBounds="true"
        android:foreground="@drawable/style_item_selector"
        android:scaleType="center"
        android:drawSelectorOnTop="true"
        android:clipChildren="true"
        android:clipToPadding="true"/>
Run Code Online (Sandbox Code Playgroud)

style_item_selector.xml

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_selected="true">
        <shape xmlns:android="http://schemas.android.com/apk/res/android">
            <size android:width="60dp" android:height="80dp" />
            <stroke android:width="1dp" android:color="#ff3591" />
            <solid android:color="@color/transparent100" />
            <corners android:radius="1dp" />
        </shape>
    </item>
</selector>
Run Code Online (Sandbox Code Playgroud)

android selecteditem shape foreground

1
推荐指数
1
解决办法
7483
查看次数