有没有办法在xml文件中指定三角形?
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="triangle">
<stroke android:width="1dip" android:color="#FFF" />
<solid android:color="#FFF" />
</shape>
Run Code Online (Sandbox Code Playgroud)
我们可以用路径形状做什么吗?我只需要一个等边三角形.
谢谢
我想为这个形状制作一个按钮

有没有办法用xml做到这一点?喜欢设置一些点,在我的情况下,我有5 ..
android android-button android-shape material-design material-components-android
这是java代码.我从图库中获取图像.我有一个Button和一个ImageView.它只旋转一次.当我再次点击按钮时,它不是旋转图像.
public class EditActivity extends ActionBarActivity
{
private Button rotate;
private ImageView imageView;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_edit);
rotate=(Button)findViewById(R.id.btn_rotate1);
imageView = (ImageView) findViewById(R.id.selectedImage);
String path = getIntent().getExtras().getString("path");
final Bitmap bitmap = BitmapFactory.decodeFile(path);
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
imageView.setImageBitmap(Bitmap.createScaledBitmap(bitmap, 510, 500,
false));
rotate.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
imageView.setRotation(90);
}
});
}
Run Code Online (Sandbox Code Playgroud)