導航:首頁 > 操作系統 > android立體按鈕

android立體按鈕

發布時間:2022-05-24 12:03:20

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的

閱讀全文

與android立體按鈕相關的資料

熱點內容
三台伺服器配置IP地址 瀏覽:171
如何用命令方塊連續對話 瀏覽:275
win7linux共享文件夾 瀏覽:302
命令符打開本地服務 瀏覽:597
android應用程序源碼 瀏覽:699
安卓開發工程師簡歷怎麼寫 瀏覽:57
熱水器水量伺服器是什麼意思 瀏覽:115
stk衛星編譯 瀏覽:478
對後台程序員的要求 瀏覽:759
ios大文件夾圖標 瀏覽:624
生的計劃pdf 瀏覽:711
oppoa93加密便簽在哪查找 瀏覽:21
兩個數字的加減乘除運算編程 瀏覽:227
給手機加密碼忘記了怎麼辦 瀏覽:601
單片機運算符 瀏覽:297
移動端微信商城源碼 瀏覽:443
編程貓下一個背景在哪裡 瀏覽:359
javaclasstype 瀏覽:240
樂高編程和樂高課的延伸 瀏覽:357
蘋果手機怎麼切換app美國賬號 瀏覽:865