Sau*_*thi 4 android textview android-layout
我正面临问题Relative layout。我textviews在我的 XML 布局中设置了几个,但在运行程序后,it will not show the text on emulator/phone. 之前一直在想,这是android studio更新版本的问题。但我还检查了另一个具有较旧 android 版本的计算机系统。我正在与大家分享 XML 代码。请帮我。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/transition_profile"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@android:color/white">
<ImageView
android:id="@+id/imgv_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@drawable/round_arrow_back_ios_24_px"
android:layout_marginTop="54dp"
android:layout_marginLeft="28dp"
android:layout_alignParentLeft="true"/>
<ImageView
android:id="@+id/imgv_help"
android:layout_width="34dp"
android:layout_height="34dp"
android:src="@drawable/round_help_outline_24_px"
android:layout_alignParentRight="true"
android:layout_marginTop="54dp"
android:layout_marginRight="28dp"/>
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/imgv_boss"
android:layout_width="126dp"
android:layout_height="126dp"
android:src="@drawable/boss"
android:layout_centerInParent="true"
android:layout_alignParentTop="true"
android:layout_marginTop="71dp"/>
<TextView
android:id="@+id/tv_emp_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="24sp"
android:textColor="#262d3d"
android:letterSpacing="0.02"
tools:text="Ramesh Singha"
android:fontFamily="@font/roboto_slab_bold"
android:layout_below="@id/imgv_boss"
android:layout_centerInParent="true"
android:layout_marginTop="26dp"/>
<TextView
android:id="@+id/tv_boss_profile_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textColor="#6c7383"
android:letterSpacing="0.02"
android:layout_below="@id/tv_emp_name"
tools:hint="Field Manager"
android:fontFamily="@font/roboto_slab_regular"
android:layout_centerInParent="true"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"/>
<LinearLayout
android:id="@+id/ll_tabslides"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#fff"
android:layout_below="@id/tv_boss_profile_name">
<com.google.android.material.tabs.TabLayout
android:id="@+id/tblyt_profile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:elevation="6dp"
android:minHeight="?attr/actionBarSize"
app:tabIndicatorColor="#0091ea"
app:tabSelectedTextColor="#0091ea"
app:tabTextColor="#6c7383"
tools:targetApi="lollipop"/>
<androidx.viewpager.widget.ViewPager
android:id="@+id/vpgr_profile"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
您正在使用tools:text="Ramesh Singha"intextView并且用于测试目的。如果要设置文本,应使用以下选项
android:text="Ramesh Singha"
添加代码
<TextView
android:id="@+id/tv_emp_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="24sp"
android:textColor="#262d3d"
android:letterSpacing="0.02"
tools:text="Ramesh Singha"
android:fontFamily="@font/roboto_slab_bold"
android:layout_below="@id/imgv_boss"
android:layout_centerInParent="true"
android:layout_marginTop="26dp" />
Run Code Online (Sandbox Code Playgroud)
TextView userName=(TextView)findViewById(R.id.tv_emp_name)
userName.setText("Ramesh Singha")
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
347 次 |
| 最近记录: |