gpt4 book ai didi

android - TextView 未出现在应用程序屏幕中。(Android)

转载 作者:行者123 更新时间:2023-11-29 17:08:51 25 4
gpt4 key购买 nike

代码如下:当我在我的设备上运行时, TextView “当前位置”和“用户地址”在应用程序屏幕上不可见。而在设计模式下则可见。我的布局代码是:

    <RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="@dimen/_40dp"
android:paddingLeft="@dimen/_10dp"
android:paddingRight="@dimen/_10dp"
android:background="@color/colorPrimary"
android:paddingBottom="@dimen/_40dp"
>
<TextView
android:layout_width="fill_parent" android:id="@+id/current"
android:layout_height="wrap_content" android:layout_marginLeft="@dimen/_30dp"
android:textSize="15dp" android:textColor="@color/background"
tools:text="Current Location" />

<TextView
android:layout_width="fill_parent" android:id="@+id/user_current_addr" android:layout_marginTop="@dimen/_10dp"
android:layout_height="wrap_content" android:layout_marginLeft="@dimen/_30dp"
android:layout_centerVertical="true" android:layout_below="@+id/current"
android:textSize="20dp" android:textColor="@color/background"
tools:text="User Address" />

</RelativeLayout>
<FrameLayout
android:id="@+id/child_fragment_container"
android:layout_width="match_parent"
android:layout_height="0dp" android:background="@color/background"
android:layout_weight="1" />
</LinearLayout>

fragment 代码是

public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
{
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_my_location, container, false);
return view;
}

屏幕是:Layout Screen

最佳答案

根据您的代码,您缺少设置 TextView 将要使用的字符串 (android:text)。现在您正在使用 tools:text="Current Location",它只会在预览屏幕中显示文本。

关于android - TextView 未出现在应用程序屏幕中。(Android),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41088342/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com