-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
80 additions
and
7 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
41 changes: 39 additions & 2 deletions
41
app/src/main/java/pmv02/ppr/yuichi10/github/com/joinevents/Home.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters