求指教

qq_38274242 2017-07-21 01:00:36

怎么实现在imageview底部加字?
<ImageView
android:id="@+id/location"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:onClick="MyOnclick"
/>
...全文
349 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
raychongzi 2017-07-26
  • 打赏
  • 举报
回复
直接写一个垂直的线性布局,点击事件监听这个布局不要监听里面的文字或图片嘛
game_dream 2017-07-25
  • 打赏
  • 举报
回复
也有很多开源组件实现这种底部导航,比如说BottomNavigation
xiaohuh421 2017-07-24
  • 打赏
  • 举报
回复
把里面的ImageView和TextView的clickable属性, 设置为false 然后再Relativlayout中设置click事件.
qq_38274242 2017-07-21
  • 打赏
  • 举报
回复
引用 4 楼 heaimnmn 的回复:
写一个嵌套布局不就行了
怎么写嘛,求列子
哎,真难 2017-07-21
  • 打赏
  • 举报
回复
写一个嵌套布局不就行了
qq_38274242 2017-07-21
  • 打赏
  • 举报
回复
引用 1 楼 ink_s 的回复:
<TextView android:id="@+id/textciew1" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#000" android:drawableTop="@drawable/button_nav_down" android:gravity="center_vertical" android:paddingLeft="16dp" android:paddingRight="16dp" android:text="消息" android:textColor="#fff" /> TextView改成Button也行。
这样写没用
  • 打赏
  • 举报
回复
我自己是动手做了一个自定义空间,去百度上面找一找相关的技术博客,或者去git上找开源控件实现以下,不难的
ink_s 2017-07-21
  • 打赏
  • 举报
回复
<TextView android:id="@+id/textciew1" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#000" android:drawableTop="@drawable/button_nav_down" android:gravity="center_vertical" android:paddingLeft="16dp" android:paddingRight="16dp" android:text="消息" android:textColor="#fff" /> TextView改成Button也行。
qq_38274242 2017-07-21
  • 打赏
  • 举报
回复
引用 6 楼 xiaohuh421 的回复:
很多控件本身就支持图片下面显示文字

嵌套布局, 就是把一个ImageView和TextView放到LinerLayout中, 就可实现上面图片, 下面文字了
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<ImageView
android:id="@+id/location"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:onClick="MyOnclick"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginRight="10dp"
android:gravity="center"
android:drawableTop="@drawable/main_location"
android:layout_alignParentBottom="true"
android:text="拍照"
android:textSize="12sp"
android:textColor="#000000"
/>
</RelativeLayout>
加了个textview之后,点击那个拍照按钮没反应了怎么解决?
xiaohuh421 2017-07-21
  • 打赏
  • 举报
回复
很多控件本身就支持图片下面显示文字 嵌套布局, 就是把一个ImageView和TextView放到LinerLayout中, 就可实现上面图片, 下面文字了

80,351

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧