Android仿優(yōu)酷圓形菜單學(xué)習(xí)筆記分享
本文實(shí)例為大家分享了Android優(yōu)酷圓形菜單的具體代碼,供大家參考,具體內(nèi)容如下
先來(lái)看看效果:
首先來(lái)分析一下:
這個(gè)菜單可以分成三個(gè)菜單:
1.一級(jí)菜單(即最內(nèi)圈那個(gè)菜單)
2.二級(jí)菜單(即中間圈那個(gè)菜單)
3.三級(jí)菜單(即最外圈那個(gè)菜單)
首先,可以將這三個(gè)菜單使用相對(duì)布局
一級(jí)菜單只有一個(gè)按鈕(即home),可以控制二級(jí)和三級(jí)菜單
二級(jí)菜單有三個(gè)按鈕(即menu),中間那個(gè)按鈕可以控制三級(jí)菜單
三級(jí)菜單有七個(gè)按鈕
那先把布局文件先寫(xiě)出來(lái),采用三個(gè)相對(duì)布局(即每個(gè)菜單采用一個(gè)相對(duì)布局)
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.youkumenu.MainActivity" > <!-- 三級(jí)菜單 --> <RelativeLayout android:id="@+id/level3_Rl" android:layout_width="220dp" android:layout_height="110dp" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:background="@drawable/level3" > <ImageView android:id="@+id/channel1" android:layout_marginLeft="5dp" android:layout_alignParentBottom="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/channel1"/> <ImageView android:id="@+id/channel2" android:layout_marginBottom="10dp" android:layout_marginLeft="25dp" android:layout_above="@id/channel1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/channel2"/> <ImageView android:layout_marginBottom="1dp" android:layout_marginLeft="52dp" android:layout_above="@id/channel2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/channel3"/> <ImageView android:layout_centerHorizontal="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/channel4"/> <ImageView android:id="@+id/channel7" android:layout_marginRight="5dp" android:layout_alignParentRight="true" android:layout_alignParentBottom="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/channel7"/> <ImageView android:id="@+id/channel6" android:layout_alignParentRight="true" android:layout_marginBottom="10dp" android:layout_marginRight="25dp" android:layout_above="@id/channel7" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/channel6"/> <ImageView android:layout_marginBottom="1dp" android:layout_marginRight="52dp" android:layout_alignParentRight="true" android:layout_above="@id/channel6" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/channel5"/> </RelativeLayout> <!-- 二級(jí)菜單 --> <RelativeLayout android:id="@+id/level2_Rl" android:layout_width="140dp" android:layout_height="70dp" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:background="@drawable/level2" > <ImageView android:layout_marginLeft="3dp" android:layout_alignParentBottom="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/icon_search"/> <ImageView android:id="@+id/menu_Iv" android:layout_centerHorizontal="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/icon_menu"/> <ImageView android:id="@+id/myyouku_Iv" android:layout_marginRight="3dp" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/icon_myyouku"/> </RelativeLayout> <!-- 一級(jí)菜單 --> <RelativeLayout android:layout_width="80dp" android:layout_height="40dp" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:background="@drawable/level1" > <ImageView android:id="@+id/home_Iv" android:layout_centerInParent="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/icon_home" /> </RelativeLayout> </RelativeLayout>
那好,布局寫(xiě)好,就能看到這樣的效果,只不過(guò)現(xiàn)在只是靜態(tài)的,沒(méi)有加邏輯而已
下面就該來(lái)分析下邏輯了,先來(lái)看看home(即一級(jí)菜單中間那個(gè)按鈕)
點(diǎn)擊home,會(huì)有三種情況,下面分情況考慮:
情況1.二級(jí)、三級(jí)菜單都顯示,就將二、三級(jí)菜單隱藏掉
情況2.二、三級(jí)菜單都不顯示的時(shí)候,就將二級(jí)菜單顯示
情況3.二級(jí)菜單顯示且三級(jí)菜單不顯示的時(shí)候,就將二級(jí)菜單隱藏
當(dāng)然我們知道,要知道菜單隱藏或者顯示,只需要設(shè)個(gè)標(biāo)記位即可
那要如何隱藏或顯示菜單,當(dāng)然是使用動(dòng)畫(huà)了,可以使用補(bǔ)間動(dòng)畫(huà)和
屬性動(dòng)畫(huà),我這里就使用補(bǔ)間動(dòng)畫(huà)
下面就該來(lái)分析下邏輯了,先來(lái)看看menu(即二級(jí)菜單中間那個(gè)按鈕)
點(diǎn)擊menu,會(huì)有三種情況,下面分情況考慮:
情況1.三級(jí)顯示的時(shí)候,就將三級(jí)菜單隱藏
情況2.三級(jí)隱藏的時(shí)候,就將三級(jí)菜單顯示
這個(gè)就比較簡(jiǎn)單了,就兩種情況。
public class MainActivity extends Activity implements OnClickListener{ //一級(jí)菜單中的home按鈕 private ImageView home_Iv; //二級(jí)菜單中的Menu按鈕 private ImageView menu_Iv; //用于判斷二級(jí)菜單的顯示狀況,true為顯示,false為隱藏 private boolean level2ListPlay = true; //用于判斷二級(jí)菜單的顯示狀況,true為顯示,false為隱藏 private boolean level3ListPlay = true; //二級(jí)和三級(jí)菜單 private RelativeLayout level2_Rl,level3_Rl; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initView(); } //初始化組件 private void initView() { home_Iv = (ImageView) findViewById(R.id.home_Iv); home_Iv.setOnClickListener(this); level2_Rl = (RelativeLayout) findViewById(R.id.level2_Rl); level3_Rl = (RelativeLayout) findViewById(R.id.level3_Rl); menu_Iv = (ImageView) findViewById(R.id.menu_Iv); menu_Iv.setOnClickListener(this); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.home_Iv: //點(diǎn)擊home按鈕的邏輯代碼 clickHomeIv(); break; case R.id.menu_Iv: clickMenuIv(); //點(diǎn)擊二級(jí)菜單中的menu按鈕的邏輯代碼 break; default: break; } } //點(diǎn)擊二級(jí)菜單中的menu按鈕的邏輯代碼 private void clickMenuIv() { //分情況考慮 //1.三級(jí)顯示的時(shí)候,就將三級(jí)菜單隱藏 if (level3ListPlay) { hideMenu(level3_Rl,0); level3ListPlay = false; return; } //2.三級(jí)隱藏的時(shí)候,就將三級(jí)菜單顯示 if (!level3ListPlay) { showMenu(level3_Rl); level3ListPlay = true; return; } } //點(diǎn)擊一級(jí)菜單中的home按鈕的邏輯代碼 private void clickHomeIv() { //分情況考慮 //1.二級(jí)、三級(jí)菜單都顯示,就將二、三級(jí)菜單隱藏掉 if (level2ListPlay && level3ListPlay) { //將二三級(jí)菜單隱藏,并改變標(biāo)記 hideMenu(level2_Rl,300); hideMenu(level3_Rl,500); level2ListPlay = false; level3ListPlay = false; return; } //2.二、三級(jí)菜單都不顯示的時(shí)候,就將二級(jí)菜單顯示 if (!level2ListPlay && !level3ListPlay) { showMenu(level2_Rl); level2ListPlay = true; return; } //3.二級(jí)菜單顯示且三級(jí)菜單不顯示的時(shí)候,就將二級(jí)菜單隱藏 if (level2ListPlay && !level3ListPlay) { hideMenu(level2_Rl,0); level2ListPlay = false; return; } } /** * 顯示菜單 * @param view 要顯示的菜單 */ private void showMenu(RelativeLayout view) { // view.setVisibility(View.VISIBLE); //旋轉(zhuǎn)動(dòng)畫(huà) RotateAnimation animation = new RotateAnimation(-180, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 1.0f); animation.setDuration(500); //設(shè)置動(dòng)畫(huà)持續(xù)的時(shí)間 animation.setFillAfter(true); //動(dòng)畫(huà)停留在動(dòng)畫(huà)結(jié)束的位置 view.startAnimation(animation); } /** * 隱藏菜單 * @param view 要隱藏的菜單 ,startOffset 動(dòng)畫(huà)延遲執(zhí)行的時(shí)間 */ private void hideMenu(RelativeLayout view,long startOffset) { // view.setVisibility(View.GONE); /** * 旋轉(zhuǎn)動(dòng)畫(huà) * RotateAnimation(fromDegrees, toDegrees, pivotXType, pivotXValue, pivotYType, pivotYValue) * fromDegrees 開(kāi)始旋轉(zhuǎn)角度 * toDegrees 旋轉(zhuǎn)的結(jié)束角度 * pivotXType X軸 參照物 (X軸的伸縮模式,可以取值為ABSOLUTE、RELATIVE_TO_SELF) * pivotXValue x軸 旋轉(zhuǎn)的參考點(diǎn)(x坐標(biāo)的伸縮值) * pivotYType Y軸 參照物 (Y軸的伸縮模式,可以取值為ABSOLUTE、RELATIVE_TO_SELF) * pivotYValue Y軸 旋轉(zhuǎn)的參考點(diǎn) ((Y坐標(biāo)的伸縮值) ) */ RotateAnimation animation = new RotateAnimation(0, -180, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 1.0f); animation.setDuration(500); animation.setFillAfter(true); //動(dòng)畫(huà)停留在動(dòng)畫(huà)結(jié)束的位置 animation.setStartOffset(startOffset); //設(shè)置動(dòng)畫(huà)的延遲執(zhí)行 view.startAnimation(animation); } }
寫(xiě)到這里,應(yīng)該差不多可以看到效果了,但是細(xì)心的伙伴應(yīng)該會(huì)發(fā)現(xiàn)兩個(gè)bug:
第一:當(dāng)你快速點(diǎn)擊一級(jí)菜單home按鈕或二級(jí)菜單menu按鈕的時(shí)候,會(huì)發(fā)現(xiàn)二級(jí)菜單或三級(jí)菜單的第一次動(dòng)畫(huà)還沒(méi)執(zhí)行完,又執(zhí)行第二次動(dòng)畫(huà),看起來(lái)就在晃一樣。(原因:就是執(zhí)行的動(dòng)畫(huà)都設(shè)定了一定時(shí)間,你點(diǎn)擊的時(shí)間快于動(dòng)畫(huà)執(zhí)行的時(shí)間)
解決辦法:
對(duì)動(dòng)畫(huà)進(jìn)行監(jiān)聽(tīng),當(dāng)動(dòng)畫(huà)開(kāi)始執(zhí)行和結(jié)束的時(shí)候,對(duì)它進(jìn)行監(jiān)聽(tīng),大家應(yīng)該會(huì)想到用一個(gè)標(biāo)記位來(lái)判斷,可我們知道一個(gè)標(biāo)記為只能判斷兩種狀態(tài),可這里有兩種動(dòng)畫(huà)(顯示的動(dòng)畫(huà)和隱藏的動(dòng)畫(huà)),一個(gè)標(biāo)記位肯定不行,可以用一個(gè)Int值來(lái)控制
//用于記錄有多少個(gè)動(dòng)畫(huà)在執(zhí)行 private int annimationCount = 0; //對(duì)動(dòng)畫(huà)進(jìn)行監(jiān)聽(tīng)的時(shí)候 animation.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation animation) { // menu_Iv.setOnClickListener(null); // home_Iv.setOnClickListener(null); annimationCount ++; } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { // menu_Iv.setOnClickListener(MainActivity.this); // home_Iv.setOnClickListener(MainActivity.this); annimationCount --; } //當(dāng)點(diǎn)擊的時(shí)候就可以進(jìn)行判斷,只要annimationCount值大于0,說(shuō)明還有動(dòng)畫(huà)在執(zhí)行 if (annimationCount > 0) { return ; }
第二:當(dāng)二級(jí)菜單隱藏的時(shí)候,你點(diǎn)擊二級(jí)菜單中menu按鈕(雖然現(xiàn)在看不見(jiàn))時(shí),你會(huì)驚奇的發(fā)現(xiàn)三級(jí)菜單居然顯示了。(原因:補(bǔ)間動(dòng)畫(huà),沒(méi)有真正的改變組件的屬性,而屬性動(dòng)畫(huà)就不一樣,大家有時(shí)間可以試試屬性動(dòng)畫(huà)做做)
解決辦法:
只要當(dāng)二級(jí)菜單隱藏的時(shí)候,就讓二級(jí)菜單的所有選項(xiàng)按鈕都不可點(diǎn)。因?yàn)槎?jí)菜單有可以能有多個(gè)按鈕,所以拿到父容器,去使它的子控件失去焦點(diǎn)即可。
//如果要顯示菜單,那么就將相應(yīng)的控件設(shè)為有焦點(diǎn) //獲取父容器中有幾個(gè)子控件 int childCount = view.getChildCount(); for (int i = 0; i < childCount; i++) { view.getChildAt(i).setEnabled(true); }
寫(xiě)到這里就差不多了,大家可以試試
這里把我寫(xiě)的完整代碼貼出來(lái):
public class MainActivity extends Activity implements OnClickListener{ //一級(jí)菜單中的home按鈕 private ImageView home_Iv; //二級(jí)菜單中的Menu按鈕 private ImageView menu_Iv; //用于判斷二級(jí)菜單的顯示狀況,true為顯示,false為隱藏 private boolean level2ListPlay = true; //用于判斷二級(jí)菜單的顯示狀況,true為顯示,false為隱藏 private boolean level3ListPlay = true; //二級(jí)和三級(jí)菜單 private RelativeLayout level2_Rl,level3_Rl; //用于記錄有多少個(gè)動(dòng)畫(huà)在執(zhí)行 private int annimationCount = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); initView(); } //初始化組件 private void initView() { home_Iv = (ImageView) findViewById(R.id.home_Iv); home_Iv.setOnClickListener(this); level2_Rl = (RelativeLayout) findViewById(R.id.level2_Rl); level3_Rl = (RelativeLayout) findViewById(R.id.level3_Rl); menu_Iv = (ImageView) findViewById(R.id.menu_Iv); menu_Iv.setOnClickListener(this); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.home_Iv: //點(diǎn)擊home按鈕的邏輯代碼 clickHomeIv(); break; case R.id.menu_Iv: clickMenuIv(); //點(diǎn)擊二級(jí)菜單中的menu按鈕的邏輯代碼 break; default: break; } } //點(diǎn)擊二級(jí)菜單中的menu按鈕的邏輯代碼 private void clickMenuIv() { //當(dāng)點(diǎn)擊的時(shí)候就可以進(jìn)行判斷,只要annimationCount值大于0,說(shuō)明還有動(dòng)畫(huà)在執(zhí)行 if (annimationCount > 0) { return ; } //分情況考慮 //1.三級(jí)顯示的時(shí)候,就將三級(jí)菜單隱藏 if (level3ListPlay) { hideMenu(level3_Rl,0); level3ListPlay = false; return; } //2.三級(jí)隱藏的時(shí)候,就將三級(jí)菜單顯示 if (!level3ListPlay) { showMenu(level3_Rl); level3ListPlay = true; return; } } //點(diǎn)擊一級(jí)菜單中的home按鈕的邏輯代碼 private void clickHomeIv() { //當(dāng)點(diǎn)擊的時(shí)候就可以進(jìn)行判斷,只要annimationCount值大于0,說(shuō)明還有動(dòng)畫(huà)在執(zhí)行 if (annimationCount > 0) { return ; } //分情況考慮 //1.二級(jí)、三級(jí)菜單都顯示,就將二、三級(jí)菜單隱藏掉 if (level2ListPlay && level3ListPlay) { //將二三級(jí)菜單隱藏,并改變標(biāo)記 hideMenu(level2_Rl,300); hideMenu(level3_Rl,500); level2ListPlay = false; level3ListPlay = false; return; } //2.二、三級(jí)菜單都不顯示的時(shí)候,就將二級(jí)菜單顯示 if (!level2ListPlay && !level3ListPlay) { showMenu(level2_Rl); level2ListPlay = true; return; } //3.二級(jí)菜單顯示且三級(jí)菜單不顯示的時(shí)候,就將二級(jí)菜單隱藏 if (level2ListPlay && !level3ListPlay) { hideMenu(level2_Rl,0); level2ListPlay = false; return; } } /** * 顯示菜單 * @param view 要顯示的菜單 */ private void showMenu(RelativeLayout view) { // view.setVisibility(View.VISIBLE); //如果要顯示菜單,那么就將相應(yīng)的控件設(shè)為有焦點(diǎn) //獲取父容器中有幾個(gè)子控件 int childCount = view.getChildCount(); for (int i = 0; i < childCount; i++) { view.getChildAt(i).setEnabled(true); } //旋轉(zhuǎn)動(dòng)畫(huà) RotateAnimation animation = new RotateAnimation(-180, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 1.0f); animation.setDuration(500); //設(shè)置動(dòng)畫(huà)持續(xù)的時(shí)間 animation.setFillAfter(true); //動(dòng)畫(huà)停留在動(dòng)畫(huà)結(jié)束的位置 view.startAnimation(animation); animation.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation animation) { //動(dòng)畫(huà)開(kāi)始的時(shí)候回調(diào) // menu_Iv.setOnClickListener(null); // home_Iv.setOnClickListener(null); annimationCount ++; } @Override public void onAnimationRepeat(Animation animation) { //動(dòng)畫(huà)執(zhí)行過(guò)程調(diào)用 } @Override public void onAnimationEnd(Animation animation) { //動(dòng)畫(huà)結(jié)束的時(shí)候調(diào)用 // menu_Iv.setOnClickListener(MainActivity.this); // home_Iv.setOnClickListener(MainActivity.this); annimationCount --; } }); } /** * 隱藏菜單 * @param view 要隱藏的菜單 ,startOffset 動(dòng)畫(huà)延遲執(zhí)行的時(shí)間 */ private void hideMenu(RelativeLayout view,long startOffset) { // view.setVisibility(View.GONE); //如果要隱藏菜單,那么就將相應(yīng)的控件設(shè)為沒(méi)有焦點(diǎn) //獲取父容器中有幾個(gè)子控件 int childCount = view.getChildCount(); for (int i = 0; i < childCount; i++) { view.getChildAt(i).setEnabled(false); } /** * 旋轉(zhuǎn)動(dòng)畫(huà) * RotateAnimation(fromDegrees, toDegrees, pivotXType, pivotXValue, pivotYType, pivotYValue) * fromDegrees 開(kāi)始旋轉(zhuǎn)角度 * toDegrees 旋轉(zhuǎn)的結(jié)束角度 * pivotXType X軸 參照物 (X軸的伸縮模式,可以取值為ABSOLUTE、RELATIVE_TO_SELF) * pivotXValue x軸 旋轉(zhuǎn)的參考點(diǎn)(x坐標(biāo)的伸縮值) * pivotYType Y軸 參照物 (Y軸的伸縮模式,可以取值為ABSOLUTE、RELATIVE_TO_SELF) * pivotYValue Y軸 旋轉(zhuǎn)的參考點(diǎn) ((Y坐標(biāo)的伸縮值) ) */ RotateAnimation animation = new RotateAnimation(0, -180, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 1.0f); animation.setDuration(500); animation.setFillAfter(true); //動(dòng)畫(huà)停留在動(dòng)畫(huà)結(jié)束的位置 animation.setStartOffset(startOffset); //設(shè)置動(dòng)畫(huà)的延遲執(zhí)行 view.startAnimation(animation); animation.setAnimationListener(new AnimationListener() { @Override public void onAnimationStart(Animation animation) { // menu_Iv.setOnClickListener(null); // home_Iv.setOnClickListener(null); annimationCount ++; } @Override public void onAnimationRepeat(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { // menu_Iv.setOnClickListener(MainActivity.this); // home_Iv.setOnClickListener(MainActivity.this); annimationCount --; } }); } }
布局文件:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.youkumenu.MainActivity" > <!-- 三級(jí)菜單 --> <RelativeLayout android:id="@+id/level3_Rl" android:layout_width="220dp" android:layout_height="110dp" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:background="@drawable/level3" > <ImageView android:id="@+id/channel1" android:layout_marginLeft="5dp" android:layout_alignParentBottom="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/channel1"/> <ImageView android:id="@+id/channel2" android:layout_marginBottom="10dp" android:layout_marginLeft="25dp" android:layout_above="@id/channel1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/channel2"/> <ImageView android:layout_marginBottom="1dp" android:layout_marginLeft="52dp" android:layout_above="@id/channel2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/channel3"/> <ImageView android:layout_centerHorizontal="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/channel4"/> <ImageView android:id="@+id/channel7" android:layout_marginRight="5dp" android:layout_alignParentRight="true" android:layout_alignParentBottom="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/channel7"/> <ImageView android:id="@+id/channel6" android:layout_alignParentRight="true" android:layout_marginBottom="10dp" android:layout_marginRight="25dp" android:layout_above="@id/channel7" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/channel6"/> <ImageView android:layout_marginBottom="1dp" android:layout_marginRight="52dp" android:layout_alignParentRight="true" android:layout_above="@id/channel6" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/channel5"/> </RelativeLayout> <!-- 二級(jí)菜單 --> <RelativeLayout android:id="@+id/level2_Rl" android:layout_width="140dp" android:layout_height="70dp" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:background="@drawable/level2" > <ImageView android:layout_marginLeft="3dp" android:layout_alignParentBottom="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/icon_search"/> <ImageView android:id="@+id/menu_Iv" android:layout_centerHorizontal="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/icon_menu"/> <ImageView android:id="@+id/myyouku_Iv" android:layout_marginRight="3dp" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/icon_myyouku"/> </RelativeLayout> <!-- 一級(jí)菜單 --> <RelativeLayout android:layout_width="80dp" android:layout_height="40dp" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:background="@drawable/level1" > <ImageView android:id="@+id/home_Iv" android:layout_centerInParent="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/icon_home" /> </RelativeLayout> </RelativeLayout>
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家繼續(xù)關(guān)注腳本之家的更多精彩內(nèi)容!
- Android 自定義組件衛(wèi)星菜單的實(shí)現(xiàn)
- Android衛(wèi)星菜單效果的實(shí)現(xiàn)方法
- Android自定義VIew實(shí)現(xiàn)衛(wèi)星菜單效果淺析
- Android實(shí)現(xiàn)自定義的衛(wèi)星式菜單(弧形菜單)詳解
- Android編程實(shí)現(xiàn)仿優(yōu)酷圓盤(pán)旋轉(zhuǎn)菜單效果的方法詳解【附demo源碼下載】
- Android學(xué)習(xí)教程之圓形Menu菜單制作方法(1)
- Android自定義view實(shí)現(xiàn)圓形與半圓形菜單
- Android圓形旋轉(zhuǎn)菜單開(kāi)發(fā)實(shí)例
- Android自定義ViewGroup實(shí)現(xiàn)帶箭頭的圓角矩形菜單
- Adapter模式實(shí)戰(zhàn)之重構(gòu)鴻洋集團(tuán)的Android圓形菜單建行
- Android實(shí)現(xiàn)衛(wèi)星菜單效果
相關(guān)文章
Android的廣播Receiver動(dòng)態(tài)注冊(cè)和靜態(tài)注冊(cè)示例
本篇文章主要介紹了Android的廣播Receiver動(dòng)態(tài)注冊(cè)和靜態(tài)注冊(cè)示例,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-02-02Android解決viewpager嵌套滑動(dòng)沖突并保留側(cè)滑菜單功能
這篇文章主要介紹了 解決viewpager嵌套滑動(dòng)沖突,并保留側(cè)滑菜單功能,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下2017-06-06使用IntelliJ IDEA 配置安卓(Android)開(kāi)發(fā)環(huán)境的教程詳解(新手必看)
這篇文章主要介紹了使用IntelliJ IDEA 配置安卓(Android)開(kāi)發(fā)環(huán)境的教程詳解(新手必看),本文通過(guò)圖文并茂的形式給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2020-09-09Android編程中常用適配器及自定義適配器用法實(shí)例分析
這篇文章主要介紹了Android編程中常用適配器及自定義適配器用法,結(jié)合實(shí)例形式較為詳細(xì)的分析了Android中適配器的概念、功能及自定義適配器的相關(guān)使用技巧,需要的朋友可以參考下2015-11-11Kotlin中協(xié)程的創(chuàng)建過(guò)程詳析
使用協(xié)程的專(zhuān)業(yè)開(kāi)發(fā)者中有超過(guò) 50% 的人反映使用協(xié)程提高了工作效率,下面這篇文章主要給大家介紹了關(guān)于Kotlin中協(xié)程創(chuàng)建過(guò)程的相關(guān)資料,文中通過(guò)實(shí)例代碼介紹的非常詳細(xì),需要的朋友可以參考下2022-01-01使用AccessibilityService實(shí)現(xiàn)自動(dòng)遍歷點(diǎn)贊功能
這篇文章主要為大家詳細(xì)介紹了使用AccessibilityService實(shí)現(xiàn)自動(dòng)遍歷點(diǎn)贊功能,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2019-12-12Android調(diào)用google地圖生成路線圖實(shí)現(xiàn)代碼
Android程序調(diào)用本機(jī)google地圖并且傳遞起始和終點(diǎn)位置生成路線圖,有需要的朋有可以參考下,或許本文對(duì)你有所幫助,好了話不多說(shuō),看代碼2013-02-02