我正在尝试使用Android Studio和Firebase构建我的第一个Android应用程序。我已将它全部连接起来,并且它正在显示来自Firebase存储的数据库和图像的内容。问题是,出于某种原因,我的文本没有显示出我添加到xml中。在帖子的底部有3个按钮,“like”,“comment”和“re-post”,他们有一个图标,然后是文本旁边的文字。图标显示完美,但文字不会显示出来。 这里是“include_post_actions.xml”问题出在哪里?文字没有显示在Android上,但在Android工作室的预览中显示
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_below="@+id/post_action_layout"
android:layout_above="@+id/include"
android:layout_width="match_parent"
android:layout_height="75dp"
android:layout_weight="1"
android:gravity="center_vertical">
<LinearLayout
android:id="@+id/post_action_buttons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<com.like.LikeButton
app:icon_type="heart"
app:icon_size="18dp"
android:id="@+id/star_button"
android:layout_width="18dp"
android:layout_height="18dp" />
<TextView
android:id="@+id/post_likes_count"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:textColor="@color/colorBlack"
android:maxLines="1"
tools:text="Like" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<ImageView
android:id="@+id/post_comment_icon"
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@drawable/ic_question_answer_black_24dp"
/>
<TextView
android:id="@+id/post_comments_count"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:textColor="@color/colorBlack"
android:maxLines="1"
tools:text="Comment" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<ImageView
android:id="@+id/post_repost_icon"
android:layout_width="20dp"
android:layout_height="20dp"
android:src="@drawable/ic_autorenew_black_24dp"
/>
<TextView
android:id="@+id/post_repost_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:textColor="@color/colorBlack"
android:maxLines="1"
tools:text="Repost" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/post_action_buttons">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginStart="20dp"
android:gravity="center_vertical"
tools:text="Likes Count"
android:id="@+id/like_count_text"
android:maxLines="1"
/>
</LinearLayout>
</RelativeLayout>
在预览文本旁边的图标显示出来,但是当我在模拟器上只有图标在那里运行它,我无法弄清楚为什么。请帮忙。谢谢。 Android Studio中
真棒,非常感谢你! –
工作就像一个魅力!非常感谢! –