⑴ android开发 手动旋转的OpenGL 立方体面加入按钮
貌似没有,需要实现每个面的选取,推荐你一篇文章,
基于Android的三维物体的触摸控制 陈建伟 同济大学软件学院
⑵ android 怎么把button变成圆形
使用shape,请看下面截图,例子来自于android学习手册,360手机助手中下载,里面有108个例子、源码还有文档。
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:Android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<!-- 填充的颜色 -->
<solid android:color="#FFFFFF"/>
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<corners android:radius="360dip"/>
<!-- padding: Button 里面的文字与Button边界的间隔 -->
<padding
android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp"
/>
</shape>
-----Main layout文件
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/soft_info"
/>
<!—直接设置背景 -->
<Button
android:id="@+id/roundBtn1"
android:background="@drawable/btn_oval"
android:layout_width="50dip"
android:layout_height="50dip"
/>
<!— 调用shape自定义xml文件 -->
<Button
android:id="@+id/roundBtn"
android:text="椭圆按钮"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/main_menu_btnshape"
/>
</LinearLayout>
----acitivity文件
public class MyLifeActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
⑶ android三个按钮叠在一起怎么解决
布局的问题
变成线性布局就行
android:overation="vertical"
⑷ 在android中按钮共分为几种
从控件来说分为2种:button(一般按钮)和ImageButton(图片按钮);
但是大部分时候,开发者是可以通过各种方式自定义按钮,这样的话,界面呈现出来的按钮是多种多样的;
TextView,view等等,很多控件其实都可以拿来当按钮使用;
此外,还有包括ToggleButton,单选按钮,多选按钮等这些都属于是功能比较专一的特殊按钮了;
我想你只有对android比较了解的情况下,才可能理解深一些吧!
⑸ Android中用什么控件可以做出类似于实况足球里那样的圆形方向控制按钮
一般都是自定义View,也可以尝试用两个View叠加起来,小圆点实现OnTouch事件
⑹ android仿饿了么加入购物车旋转控件动画按钮
这个二维控件不支持,你可以对按钮进行动画式的先变窄再变宽,并进行颜色变换,从而达到模拟立体翻转的效果。更推荐的方法是直接使用WPF的3D功能,制作长方形,并在正反面都使用VisualBrush,而VisualBrush绑定到控件,使得这个长方形看起来像一个立体的按钮,并且拥有正反面,最后使用Transform3D派生的Rotetransform3D进行真正意义上的旋转。
⑺ android中带图标的按钮(ImageButton)怎么用
除了Android系统自带的Button按钮以外,还提供了带图标的按钮ImageButton
要制作带图标的按钮,首先要在布局文件中定义ImageButton,然后通过setImageDrawable方法来设置要显示的图标。
注意:
我们可以在布局文件中就直接设置按钮的图标,如
android:src=”@drawable/icon1″
我们也可以在程序中设置自定义图标
imgbtn3.setImageDrawable(getResources().getDrawable(R.drawable.icon2));
我们还可以使用系统自带的图标
imgbtn4.setImageDrawable(getResources().getDrawable(android.R.drawable.sym_call_incoming));
设置完按钮的图标后,需要为按钮设置监听setOnClickListener,以此捕获事件并处理
下面的例子讲述的是由4个图标按钮组成的布局,其中三个按钮的图标是自定义的,第四个按钮的图标是系统的,当点击按钮1的时候,弹出dialog,当点击按钮2的时候,点击确定后,可以将按钮2的图标变成按钮3的图标,当点击按钮3的时候,按钮3的图标变成了系统打电话的图标,点击按钮4,显示一个提示dialog
ImageButtonTest.java源代码
package org.loulijun.imagebutton;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;
public class ImageButtonTest extends Activity {
/** Called when the activity is first created. */
TextView textview;
ImageButton imgbtn1;
ImageButton imgbtn2;
ImageButton imgbtn3;
ImageButton imgbtn4;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
textview=(TextView)findViewById(R.id.textview);
//分别取得4个ImageButton对象
imgbtn1=(ImageButton)findViewById(R.id.imagebutton1);
imgbtn2=(ImageButton)findViewById(R.id.imagebutton2);
imgbtn3=(ImageButton)findViewById(R.id.imagebutton3);
imgbtn4=(ImageButton)findViewById(R.id.imagebutton4);
//分别为ImageButton设置图标
//imgbtn1已经在main.xml布局中设置了图标,所以就不在这里设置了(设置图标即可在程序中设置,也可在布局文件中设置)
imgbtn2.setImageDrawable(getResources().getDrawable(R.drawable.icon));//在程序中设置图标
imgbtn3.setImageDrawable(getResources().getDrawable(R.drawable.icon2));
imgbtn4.setImageDrawable(getResources().getDrawable(android.R.drawable.sym_call_incoming));//设置系统图标
//下面为各个按钮设置事件监听
imgbtn1.setOnClickListener(new Button.OnClickListener()
{
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Dialog dialog=new AlertDialog.Builder(ImageButtonTest.this)
.setTitle("提示")
.setMessage("我是ImageButton1")
.setPositiveButton("确定",new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
//相应的处理操作
}
}).create();
dialog.show();
}
});
imgbtn2.setOnClickListener(new Button.OnClickListener()
{
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Dialog dialog=new AlertDialog.Builder(ImageButtonTest.this)
.setTitle("提示")
.setMessage("我是ImageButton2,我要使用ImageButton3的图标")
.setPositiveButton("确定",new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
imgbtn2.setImageDrawable(getResources().getDrawable(R.drawable.icon2));
}
}).create();
dialog.show();
}
});
imgbtn3.setOnClickListener(new Button.OnClickListener()
{
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Dialog dialog=new AlertDialog.Builder(ImageButtonTest.this)
.setTitle("提示")
.setMessage("我是ImageButton3,我想使用系统打电话的图标")
.setPositiveButton("确定",new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
imgbtn3.setImageDrawable(getResources().getDrawable(android.R.drawable.sym_action_call));
}
}).create();
dialog.show();
}
});
imgbtn4.setOnClickListener(new Button.OnClickListener()
{
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Dialog dialog=new AlertDialog.Builder(ImageButtonTest.this)
.setTitle("提示")
.setMessage("我是使用的系统图标")
.setPositiveButton("确定",new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
//相应的处理操作
}
}).create();
dialog.show();
}
});
}
}
布局文件main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="@+id/textview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="ImageButton测试案例"
/>
<ImageButton
android:id="@+id/imagebutton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/icon1"
/>
<ImageButton
android:id="@+id/imagebutton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<ImageButton
android:id="@+id/imagebutton3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<ImageButton
android:id="@+id/imagebutton4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
⑻ android怎么设置按钮弧形
设置按钮为弧形的话,你可以使用shape.xml,设置四个角的角度,然后就可以显示弧形,将按钮的背景设置成shape
⑼ android中如何设置不同形状的按钮
直接把按钮的样式换成别的图片不久好了android:background="@drawable/btn_bg"。。然后设置个点击效果xml
drawable/btn_bg.xml
<?xml version="1.0" encoding="utf-8"?><selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" android:drawable="@drawable/press"/> <item android:state_pressed="false" android:drawable="@drawable/normal"/></selector>
⑽ android中,如何做圆形的button按钮
自己绘制圆形的图片,然后在button布局里面用BackgroundDrawable设置为button背景。android中是不带圆形的button的