I just started fiddling with android wear sdk . I created a list and found out that it normally renders with a top empty region.
I need that removed, but I couldn't find anything on it .
I just started fiddling with android wear sdk . I created a list and found out that it normally renders with a top empty region.
I need that removed, but I couldn't find anything on it .
Go to your Adapter class and add a code as below:
private final Activity mContext;
private final Fragment[][] mFragment;
public MyGridViewPagerAdapter(Activity ctx, FragmentManager fm, Fragment[][] fragments)
{
super(fm);
mContext = ctx;
this.mFragment = fragments;
}
then override the following methods:
@Override
public Fragment getFragment(int row, int col)
{
return mFragment[row][col];
}
@Override
public int getRowCount()
{
return mFragment.length;
}
@Override
public int getColumnCount(int rowNum)
{
return mFragment[rowNum].length;
}
then in your activity do as following:
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my);
final GridViewPager pager = (GridViewPager) findViewById(R.id.pager);
final Fragment[][] items = {
{
CusmtomFragment.newInstance("your","arguments"),
CusmtomFragment.newInstance()
},
{
OtherFragment.newInstance(),
AnotherFragment.newInstance(1234)
}
};
// ....
pager.setAdapter(new MyGridViewPagerAdapter(this, getFragmentManager(), items));
}
Check also this issue: Is there any way to detect if the clock is round?
Hope it will help