이제 Listview의 레이아웃이 조금 엉망이되었습니다. 모든 행의 textviews가 이제는 화면을 가로로 채우는 동안 자유롭게 있어야합니다.ListView의 레이아웃이 겹쳐졌습니다.
EDIT : 현재 상황을보다 정확하게 설명하기 위해 텍스트를 업데이트했습니다. EDIT2 : 이것은 UI를 같이하도록되어 할 수 있습니다 :
위의 부분은이 같이 가정하고, 아래 부분은 현재 표시되는 것입니다 무슨이다.
내 ListView에 레이아웃 :<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:id="@+id/goal_name"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_alignParentLeft="true"/>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:orientation="horizontal"
android:layout_centerHorizontal="true">
<TextView
android:id="@+id/goal_progress"
android:layout_height="wrap_content"
android:layout_width="wrap_content"/>
<TextView
android:id="@+id/seperator"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/seperator"/>
<TextView
android:id="@+id/goal_limit"
android:layout_height="wrap_content"
android:layout_width="wrap_content"/>
<!--
<ProgressBar
android:id="@+id/progress_bar"
android:layout_height="wrap_content"
android:layout_width="wrap_content"/>
-->
</LinearLayout>
</RelativeLayout>
내 메인 페이지 레이아웃 :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="nl.tizin.healthapp.GoalMainScreen$PlaceholderFragment">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="5dp">
<TextView
android:id="@+id/name_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="@string/name_header_text"
android:textStyle="bold"/>
<TextView
android:id="@+id/day_header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="@string/day_header_text"
android:textStyle="bold"/>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ListView
android:id="@+id/list_of_goals"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</ListView>
<TextView
android:id="@+id/empty_goal_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/no_goals_added"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/add_exercise_goal_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/add_exercise_goal_button_text"
android:onClick="addExerciseGoal"/>
<Button
android:id="@+id/add_food_goal_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/add_food_goal_button_text"
android:onClick="addFoodGoal"/>
</LinearLayout>
내에서 onCreate 방법 : 사람이 할 수있는 경우
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.goal_main_screen);
mGoalList = (ListView) findViewById(R.id.list_of_goals);
mGoalList.setEmptyView((View) findViewById(R.id.empty_goal_list));
mGoalList.setOnItemClickListener(new OnItemClickListener(){
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
Cursor c = (Cursor) mGoalList.getItemAtPosition(position);
//Get ID of goal and increment day value
checkInGoal(c.getInt(0));
System.out.println(c.getString(1));
}
});
populateList();
나는 그것을 감사하겠습니다 도와주세요. 너무 오랫동안 이것을 쳐다 보았다.
죄송합니다. 코드를 올바르게 붙여 넣지 않았기 때문입니다. 나는 항구를 바로 편집 할 것이다. – Anubis
제안 사항은 텍스트보기가 더 이상 겹쳐지지 않지만 여전히 뭉친 상태라는 점에서 도움이되었습니다. android : layout_centerHorizontal 태그가 무시당하는 것 같습니다. – Anubis
현재 유일한 문제는 android : layout_centerHorizontal 및 android : layout_alignParentLeft 태그에 의해 지시 된대로 화면을 채우는 동안 목록보기의 내용이 래핑 된 것처럼 보이는 것입니다. – Anubis