Мне нужна помощь, пожалуйста, я не могу показать текст внизу или внизу на моем значке или изображении в ImageButton
Я попытался использовать TextView
, но он путает мою кнопку. У меня нет идеи, как для отображения текста. вот мой xml.текст не отображается в ImageButton со значком или изображением
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:orientation="horizontal"
android:background="#eeeeee" android:layout_marginTop="30dp">
<ImageButton
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginBottom="5dp"
android:layout_marginLeft="2dp"
android:layout_marginRight="5dp"
android:layout_marginTop="2dp"
android:layout_weight="1"
android:adjustViewBounds="true"
android:padding="30dp"
android:scaleType="fitCenter"
android:background="@drawable/button1_style"
android:src="@drawable/icon1_48dp"
style="@style/Widget.AppCompat.Button.Colored" />
<ImageButton
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginBottom="5dp"
android:layout_marginLeft="2dp"
android:layout_marginRight="5dp"
android:layout_marginTop="2dp"
android:layout_weight="1"
android:adjustViewBounds="true"
android:padding="30dp"
android:scaleType="fitCenter"
style="@style/Widget.AppCompat.Button.Colored"
android:background="@drawable/button2_style"
android:src="@drawable/icon2_48dp"
android:tint="#ffffff"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="200dp"
android:orientation="horizontal"
android:background="#eeeeee" android:layout_marginBottom="20dp">
<ImageButton
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginBottom="5dp"
android:layout_marginLeft="2dp"
android:layout_marginRight="5dp"
android:layout_marginTop="2dp"
android:layout_weight="1"
android:adjustViewBounds="true"
android:padding="30dp"
android:scaleType="fitCenter"
style="@style/Widget.AppCompat.Button.Colored"
android:src="@drawable/icon3_48dp"
android:background="@drawable/button3_style"
android:tint="#ffffff"
/>
<ImageButton
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginBottom="5dp"
android:layout_marginLeft="2dp"
android:layout_marginRight="5dp"
android:layout_marginTop="2dp"
android:layout_weight="1"
android:adjustViewBounds="true"
android:padding="30dp"
android:scaleType="fitCenter"
style="@style/Widget.AppCompat.Button.Colored"
android:src="@drawable/icon4_48dp"
android:background="@drawable/button4_style"
/>
</LinearLayout>
</LinearLayout>
текст не может показать в '' ImageButton'' http://stackoverflow.com/questions/21776676/set-the-text-in -imagebutton –
Как применить TextView? – jemz
вы хотите, чтобы кнопка была '' ImageButton'' или только '' Button''? –