Skip to content

Commit

Permalink
cannot solve scroll view
Browse files Browse the repository at this point in the history
  • Loading branch information
yuichi10 committed Aug 20, 2015
1 parent 51b0960 commit 1ada2cc
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 7 deletions.
11 changes: 11 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,22 +1,59 @@
package pmv02.ppr.yuichi10.github.com.joinevents;

import android.app.Activity;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;

import java.util.List;

/**
* Created by yuichi on 8/20/15.
*/
public class Home extends Activity{
public class Home extends Activity {
ArrayAdapter<String> adapter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.home);
Log.d("Intent", "success");
Intent intent = getIntent();
adapter = new ArrayAdapter<String>(this, R.layout.colmun_home_list);
getGroups();
ListView listView = (ListView)this.findViewById(R.id.homeList);
getListMountHeight(listView);
listView.setAdapter(adapter);
}

public void getListMountHeight(ListView lv){
ListAdapter la = lv.getAdapter();
if (la == null)
{
return;
}
int height = 0;

for(int i=0; i < la.getCount(); i++){
View item = la.getView(i, null, lv);
item.measure(0,0);
height += item.getHeight();
}
ViewGroup.LayoutParams p = lv.getLayoutParams();
p.height = height + (lv.getDividerHeight() * (la.getCount() - 1));
lv.setLayoutParams(p);
}

TextView tv = (TextView)findViewById(R.id.homeText);
//get groups from server
public void getGroups(){
for(int i=0; i < 10; ++i){
adapter.add("aaaaaaa" + i);
}
}
}
7 changes: 7 additions & 0 deletions app/src/main/res/layout/colmun_home_list
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:text="@+id/TextView01" android:id="@+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="50dp">

</TextView>
21 changes: 16 additions & 5 deletions app/src/main/res/layout/home.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,21 @@
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
android:id="@+id/homeText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello Home"/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="500dp">

<ListView
android:id="@+id/homeList"
android:choiceMode="singleChoice"
android:layout_width="match_parent"
android:layout_height="match_parent" />

</ScrollView>
<Button
android:id="@+id/homeMakeGrope"
android:layout_width="match_parent"
android:layout_height="50dp"
android:text="Make New Group" />

</LinearLayout>

0 comments on commit 1ada2cc

Please sign in to comment.