- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在一个包含两个选项卡的屏幕上工作。我在这里使用 AppCompatActivity。我在选项卡中设置了带有文本的图标,但我希望图像右对齐并且它们之间应该有一些空间。代码如下:
<强>1。 Activity_ProfessionalTimeline.java
public class Activity_ProfessionalTimeline extends AppCompatActivity implements OnClickListener {
private Toolbar toolbatTop;
private TabLayout tabLayout;
private ViewPager viewPager;
private TabsPagerAdapter mAdapter;
private ActionBar actionBar;
private int[] tabIcons = {
R.drawable.social,
R.drawable.professional
};
private ImageView _img_Profile;
private TextView _txt_UserName;
private TextView _txt_UserDestination;
ArrayList<Model_LoginDetails> arr_LogInUserDetails = new ArrayList<Model_LoginDetails>();
private ImageView _imt_userImage;
private ListView _listView_SelectOpition;
private boolean profilebtnstatus = false;
private RelativeLayout _relativelayour_status;
private ListView _listviewmoroption;
private DrawerLayout drawer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_professionalttimeline);
// Top Toolbar
Toolbar toolbarTop = (Toolbar) findViewById(R.id.toolbar_top);
toolbarTop.setTitle("Recent Professional Activities");
LayoutInflater inflator = (LayoutInflater) this
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
setSupportActionBar(toolbarTop);
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setStackedBackgroundDrawable(new ColorDrawable(Color
.parseColor("#fbae38")));
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(Color
.parseColor("#2b4d72")));
//getSupportActionBar().setIcon(R.drawable.appicon);
View actionBarView = inflator.inflate(R.layout.actionbar_custom_layout,
null);
ImageView _mProfileImage = (ImageView) actionBarView
.findViewById(R.id.img_Profile);
/*Picasso.with(Activity_ProfessionalTimeline.this)
.load(arr_LogInUserDetails.get(0).getThumbnail_url())
.into(_mProfileImage);*/
LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.MATCH_PARENT);
getSupportActionBar().setCustomView(actionBarView);
drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
Bundle bundle = getIntent().getExtras();
arr_LogInUserDetails = bundle.getParcelableArrayList("mylist");
_imt_userImage = (ImageView) findViewById(R.id.imt_userImage);
_txt_UserName = (TextView) findViewById(R.id.txt_UserName);
_txt_UserDestination = (TextView) findViewById(R.id.txt_Userdestination);
_img_Profile = (ImageView) findViewById(R.id.img_Profile);
_listviewmoroption = (ListView) findViewById(R.id.listviewmoroption);
_listviewmoroption.setAdapter(new Adapter_MenuOpition(
Activity_ProfessionalTimeline.this));
_listviewmoroption.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
switch (arg2) {
case 0:
fun_hidemenu();
Bundle bundle = new Bundle();
Intent int_ProfessionalTimeline = new Intent(
Activity_ProfessionalTimeline.this,
Acitivty_AccountSetting.class);
bundle.putParcelableArrayList("mylist",
arr_LogInUserDetails);
int_ProfessionalTimeline.putExtras(bundle);
startActivity(int_ProfessionalTimeline);
break;
case 1:
break;
case 2:
finish();
break;
default:
break;
}
}
});
_relativelayour_status = (RelativeLayout) findViewById(R.id.reltv_Menu);
_listView_SelectOpition = (ListView) findViewById(R.id.list_allSelection);
_listView_SelectOpition.setAdapter(new Adapter_SelectionOpition(
Activity_ProfessionalTimeline.this));
_listView_SelectOpition
.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
drawer.closeDrawers();
switch (arg2) {
case 0:
break;
case 1:
Intent int_Intership = new Intent(Activity_ProfessionalTimeline.this, Tab_InterShip.class);
int_Intership.putExtra("image", arr_LogInUserDetails.get(0).getThumbnail_url());
startActivity(int_Intership);
break;
case 2:
Intent int_AddJob = new Intent(Activity_ProfessionalTimeline.this, Tab_AddJob.class);
int_AddJob.putExtra("image", arr_LogInUserDetails.get(0).getThumbnail_url());
int_AddJob.putExtra("addjob", "addJob");
startActivity(int_AddJob);
break;
case 3:
Intent int_SearchJob = new Intent(Activity_ProfessionalTimeline.this, Tab_SearchJob.class);
int_SearchJob.putExtra("image", arr_LogInUserDetails.get(0).getThumbnail_url());
startActivity(int_SearchJob);
break;
case 4:
Intent int_PostedJob = new Intent(Activity_ProfessionalTimeline.this, Tab_PostedJob.class);
int_PostedJob.putExtra("image", arr_LogInUserDetails.get(0).getThumbnail_url());
startActivity(int_PostedJob);
break;
case 5:
Intent int_AppliedJob = new Intent(Activity_ProfessionalTimeline.this, TabFragment_AppliedJob.class);
int_AppliedJob.putExtra("image", arr_LogInUserDetails.get(0).getThumbnail_url());
startActivity(int_AppliedJob);
break;
case 6:
Intent int_JobMENTOR = new Intent(Activity_ProfessionalTimeline.this, Tab_JobMentor.class);
int_JobMENTOR.putExtra("image", arr_LogInUserDetails.get(0).getThumbnail_url());
startActivity(int_JobMENTOR);
break;
case 7:
Intent int_JobMEtees = new Intent(Activity_ProfessionalTimeline.this, Tab_mentees.class);
int_JobMEtees.putExtra("image", arr_LogInUserDetails.get(0).getThumbnail_url());
startActivity(int_JobMEtees);
break;
case 8:
break;
case 9:
break;
case 10:
break;
default:
break;
}
}
});
_img_Profile.setOnClickListener(this);
Picasso.with(Activity_ProfessionalTimeline.this)
.load(arr_LogInUserDetails.get(0).getThumbnail_url())
.into(_imt_userImage);
_txt_UserName.setText(arr_LogInUserDetails.get(0).getUser_Name());
_txt_UserDestination.setText(arr_LogInUserDetails.get(0)
.getUser_Skills());
viewPager = (ViewPager) findViewById(R.id.pager);
setupViewPager(viewPager);
tabLayout = (TabLayout) findViewById(R.id.tab_layout);
tabLayout.setupWithViewPager(viewPager);
//----Call this function for displaying image in tab
setupTabIcons();
}
private void setupTabIcons() {
tabLayout.getTabAt(0).setIcon(tabIcons[0]);
tabLayout.getTabAt(1).setIcon(tabIcons[1]);
}
private void setupViewPager(ViewPager viewPager) {
ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager());
adapter.addFrag(new TabFragment_Social(Activity_ProfessionalTimeline.this, arr_LogInUserDetails), "Social");
adapter.addFrag(new TabFragment_Professional(), "Professional");
viewPager.setAdapter(adapter);
}
class ViewPagerAdapter extends FragmentPagerAdapter {
private final List<Fragment> mFragmentList = new ArrayList<>();
private final List<String> mFragmentTitleList = new ArrayList<>();
public ViewPagerAdapter(FragmentManager manager) {
super(manager);
}
@Override
public Fragment getItem(int position) {
return mFragmentList.get(position);
}
@Override
public int getCount() {
return mFragmentList.size();
}
public void addFrag(Fragment fragment, String title) {
mFragmentList.add(fragment);
mFragmentTitleList.add(title);
}
@Override
public CharSequence getPageTitle(int position) {
return mFragmentTitleList.get(position);
}
}
@Override
public void onClick(View arg0) {
switch (arg0.getId()) {
case R.id.img_Profile:
if (profilebtnstatus == false) {
_relativelayour_status.setVisibility(View.VISIBLE);
_img_Profile.setBackgroundColor(Color.parseColor("#faad38"));
profilebtnstatus = true;
} else {
fun_hidemenu();
}
break;
default:
break;
}
}
private void fun_hidemenu() {
if (profilebtnstatus == true) {
_relativelayour_status.setVisibility(View.GONE);
_img_Profile.setBackgroundColor(Color.parseColor("#2b4d72"));
profilebtnstatus = false;
}
}
}
2.activity_professionaltimeline.xml
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--Top Toolbar-->
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar_top"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#3f5e7e"
android:elevation="6dp"
android:minHeight="?attr/actionBarSize"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<android.support.design.widget.TabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/toolbar_top"
android:background="#fbae38"
android:elevation="6dp"
android:minHeight="?attr/actionBarSize"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:tabGravity="fill"
app:tabMode="fixed"/>
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/reltv_footer"></android.support.v4.view.ViewPager>
<RelativeLayout
android:id="@+id/reltv_footer"
android:layout_width="match_parent"
android:layout_height="50sp"
android:layout_alignParentBottom="true"
android:background="#2b4d72">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:padding="20sp" />
<ImageView
android:id="@+id/img_Profile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="#2b4d72"
android:padding="15sp"
android:src="@drawable/more_option" />
<View
android:id="@+id/img_view"
android:layout_width="3sp"
android:layout_height="fill_parent"
android:layout_toLeftOf="@+id/img_Profile"
android:background="#335980" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_toLeftOf="@+id/img_view"
android:background="#2b4d72"
android:gravity="left"
android:orientation="horizontal">
<ImageView
android:id="@+id/home"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:background="#203b58"
android:padding="15sp"
android:src="@drawable/home" />
<View
android:layout_width="2sp"
android:layout_height="fill_parent"
android:layout_toLeftOf="@+id/img_Profile"
android:background="#203b58" />
<ImageView
android:id="@+id/friendrequest"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:padding="15sp"
android:src="@drawable/friend_req" />
<View
android:layout_width="2sp"
android:layout_height="fill_parent"
android:layout_toLeftOf="@+id/img_Profile"
android:background="#203b58" />
<ImageView
android:id="@+id/message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:padding="15sp"
android:src="@drawable/meg" />
<View
android:layout_width="2sp"
android:layout_height="fill_parent"
android:layout_toLeftOf="@+id/img_Profile"
android:background="#203b58" />
<ImageView
android:id="@+id/notification"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:padding="15sp"
android:src="@drawable/footer_notification" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/reltv_Menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/reltv_footer"
android:layout_alignParentRight="true"
android:background="#ffffff"
android:visibility="gone">
<ListView
android:id="@+id/listviewmoroption"
android:layout_width="200sp"
android:layout_height="wrap_content"
android:divider="#6d6d6d"
android:dividerHeight="1sp"></ListView>
</RelativeLayout>
</RelativeLayout>
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
android:id="@+id/left_drawer"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="right"
android:background="@android:color/white"
android:choiceMode="singleChoice"
android:orientation="vertical">
<include layout="@layout/cust_rightnavigationdrawer" />
</LinearLayout>
<强>3。截图
请告诉我如何给图标和文本之间的空间。
最佳答案
我有你们想要的确切解决方案。
<android.support.design.widget.TabLayout
android:id="@+id/tabLayout"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:tabInlineLabel="true"
app:tabPaddingStart="@dimen/default_10dp">
使用下面的属性你可以达到想要的结果。
应用:tabInlineLabel="真"
关于android - 如何在 Android 中的 TabLayout 选项卡中将图标与文本对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34313027/
我从来没有遇到过这种问题 - 我也不知道为什么.. 有些图标丢失并以“?/!”闪烁显示 发生了什么事? 它是一个提交按钮。我在另一个按钮中有相同的图标 - 那里没问题。 SIGN! 有什
我只需要在单击按钮时显示 ionic 图标。 我试着在那个图标上放一个类并做到了: .icn { visibility: visible; } 但是没有用,有没有人知道另一种方法? 最佳答案 Sho
我用qt在托盘里做了一个应用。在我的电脑上,这是一个很好的项目,我在托盘栏中看到了图标,但是当我将其发布给其他人时,他们看不到该图标,它只是一个可以使用但不显示图标的隐形方 block 。但在我的电脑
我想使用delphi将图标/ bmp绘制到TListView的子项中。但是我不知道该怎么做到。它适用于列表中的第一项,但子项存在问题。 最佳答案 您可以使用CustomDrawSubItem事件。 下
我想将标题栏中的图标设置为应用程序的图标 [[myWindow standardWindowButton:NSWindowDocumentIconButton] setImage:[NSApp app
可以设置一个图标,以便在当前应用程序的每个窗口上使用它。这样我就设置了一次(不是手动在每个窗口上设置)..? 最佳答案 关于这个主题的一个很好的引用在这里 MSDN 。表明您有一个应用程序图标(桌面图
我为自己制作了一个小书签,它的功能很好,但当添加到 Opera 或 Firefox 的工具栏时,它只是呈现浏览器的默认书签图标(分别是地球仪和星星)。我的网站有一个网站图标,窗口、选项卡甚至 [网站]
制表符中的responsiveCollapse 折叠展开功能的默认图标似乎未居中。是否有更改此图标的选项。也许是右下胡萝卜? 最佳答案 responsiveCollapse 格式化程序只是一个像所有其
上面是下拉列表,当单击列表时,其值将与图像一起显示在上面的字段(顺便说一句,这是一个按钮)中。我已经实现了显示文本,但似乎无法显示图像。这是我的标记如下... 广东 @foreach
我想将我们数据库中的电线杆和电缆导出到 Google 地球的 KML 文件中。 对于每个节点,我们都有一个极阵列,电缆始终连接到阵列中的下一个极。 制作简单路径的导出似乎很容易。但是这些路径只是显示一
我想将我们数据库中的电线杆和电缆导出到 Google 地球的 KML 文件中。 对于每个节点,我们都有一个极阵列,电缆始终连接到阵列中的下一个极。 制作简单路径的导出似乎很容易。但是这些路径只是显示一
在 JTable 中显示数据。一列用作字段复选框。问题是在显示ChceckBox 中而不是出现图标true/false。我该如何解决这个问题? 添加数据: private DefaultTableMo
[编辑] 我想使用 DataTable 在 Datagridview 中使用图像。 RadioButton 只是这篇文章的一种简单问题格式。 让我为此澄清一下。 如何使用绑定(bind)样式在 dat
我正在使用 C# 开发 win 表单应用程序。我遇到了一个需要向用户提供 ComboBox 的场景。现在,为了使外观更具吸引力,我想在该组合框的每个项目之前显示一个小图像或图标。 我查看了一些提供此功
我正在 CrossRider 中构建一个扩展。我需要在数据库中保存我有它们的 url 的图像/图标。它们是微小的图像,不会成为数据库中的问题。我可能有类似的东西可以访问 background.js:
我需要使用我的 JavaFX 应用程序中的一些元素,这些元素使用 带有自定义符号/图标的按钮 横幅或背景图像。 此应用程序应该在具有不同屏幕分辨率的多个设备上运行,并且我还(最终)需要缩放图像/图标(
我怎样才能在 android studio 中做这样的事情: 我想要一个导航栏,您可以在其中看到名称、图标以及打开抽屉导航的机会 :D (图片是用Figma制作的) 最佳答案 将重力设置为在 Draw
当我在 ViewPager 中滑动 fragment 时,如何动态更改 Action Bar 的操作按钮图标。取决于 fragment 按钮必须改变状态(图标)。 最佳答案 您可以在 onPrepar
我有两个 while 循环,一个是循环遍历聊天日志以检索日期、用户名、消息,另一个 while 循环 是从单独的表中检索图标这有两列 chars 和 image (image-name.*) 我可以显
我正在尝试重新启动 mysql(一个完全不同的问题),MySql 肯定已安装(版本 14.14),并且根据我收集的信息,我应该在系统偏好设置面板的底部看到它的图标,但它是不在那里。安装过程中是否出现了
我是一名优秀的程序员,十分优秀!