Java 如何设置路线的布局?
我不知道如何设置路线的布局?也许这是一个简单的问题,但我不知道,我是一个新的Android开发者。请提供思考方式,谢谢! 此页面由两个布局组成,父布局和子布局:Java 如何设置路线的布局?,java,android,android-layout,Java,Android,Android Layout,我不知道如何设置路线的布局?也许这是一个简单的问题,但我不知道,我是一个新的Android开发者。请提供思考方式,谢谢! 此页面由两个布局组成,父布局和子布局: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizo
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/table_cell_bg_color">
<TextView
android:id="@+id/parent_task_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingLeft="40px"
android:paddingTop="6px"
android:paddingBottom="6px"
android:textSize="18sp"
android:textColor="#2B2B2B"
android:text="No data"/>
<ImageView
android:id="@+id/arrow_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:src="@drawable/ram_arrow_close"/>
</LinearLayout>
可能的解决方案
可以与布局一起使用
android:gravity=""
及
使用此代码
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/table_cell_bg_color">
<TextView
android:id="@+id/child_task_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#2B2B2B"
android:text="No Data" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/arrow_layout"
android:layout_toLeftOf="@+id/arrow_layout"
android:layout_toStartOf="@+id/arrow_layout"
android:paddingRight="10dp">
<TextView
android:id="@+id/child_task_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="@color/text_blue"
android:text="No Data"/>
</LinearLayout>
<LinearLayout
android:id="@+id/arrow_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:paddingRight="10dp">
<ImageView
android:id="@+id/arrow_child"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ram_arrow_icon"/>
</LinearLayout>
我认为您正在使用列表视图或recyclerview,因此您应该使用此视图根据数组大小重复内容这是json的结果。我希望数字在一列中!如何修复?尝试TableLayout和TableRow
android:layout_gravity=""
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/table_cell_bg_color">
<TextView
android:id="@+id/child_task_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#2B2B2B"
android:text="No Data" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/arrow_layout"
android:layout_toLeftOf="@+id/arrow_layout"
android:layout_toStartOf="@+id/arrow_layout"
android:paddingRight="10dp">
<TextView
android:id="@+id/child_task_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:textColor="@color/text_blue"
android:text="No Data"/>
</LinearLayout>
<LinearLayout
android:id="@+id/arrow_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:paddingRight="10dp">
<ImageView
android:id="@+id/arrow_child"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ram_arrow_icon"/>
</LinearLayout>