【问题标题】:How to make this type of layout in android如何在android中制作这种类型的布局
【发布时间】:2016-07-18 10:28:38
【问题描述】:

我必须做出这种布局。

像这样:

我需要这个阴影效果,我尝试了很多但没有得到它。

【问题讨论】:

  • 请分享您的尝试,以便更好地帮助您

标签: android android-layout


【解决方案1】:

【讨论】:

    【解决方案2】:

    我建议你,你需要为底部导航创建自定义形状,创建底部导航见Bottom Navigation然后给选定的选项阴影,阴影检查this

    public class ThreeButtonsActivity extends AppCompatActivity {
        private CoordinatorLayout coordinatorLayout;
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_three_buttons);
    
            coordinatorLayout = (CoordinatorLayout) findViewById(R.id.three_buttons_activity);
    
            BottomBar bottomBar = BottomBar.attach(this, savedInstanceState);
            bottomBar.setItemsFromMenu(R.menu.three_buttons_menu, new OnMenuTabSelectedListener() {
                @Override
                public void onMenuItemSelected(int itemId) {
                    switch (itemId) {
                        case R.id.recent_item:
                            Snackbar.make(coordinatorLayout, "Recent Item Selected", Snackbar.LENGTH_LONG).show();
                            break;
                        case R.id.favorite_item:
                            Snackbar.make(coordinatorLayout, "Favorite Item Selected", Snackbar.LENGTH_LONG).show();
                            break;
                        case R.id.location_item:
                            Snackbar.make(coordinatorLayout, "Location Item Selected", Snackbar.LENGTH_LONG).show();
                            break;
                    }
                }
            });
    
            // Set the color for the active tab. Ignored on mobile when there are more than three tabs.
            bottomBar.setActiveTabColor("#C2185B");
    
            // Use the dark theme. Ignored on mobile when there are more than three tabs.
            //bottomBar.useDarkTheme(true);
    
            // Use custom text appearance in tab titles.
            //bottomBar.setTextAppearance(R.style.MyTextAppearance);
    
            // Use custom typeface that's located at the "/src/main/assets" directory. If using with
            // custom text appearance, set the text appearance first.
            //bottomBar.setTypeFace("MyFont.ttf");
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-05-19
      • 1970-01-01
      • 2023-03-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多