, .
, , .
4 editTexts , .
:
<LinearLayout
android:layout_width="0dp"
android:layout_height="0dp"
android:background="@android:color/transparent"
android:focusable="true"
android:focusableInTouchMode="true">
</LinearLayout>
This has been added to Code Activity (note the slight difference with Timmmm's answer: I don't have
mViewPager.getCurrentItem() == 0
here because I need to hide the keyboard for each view:
mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
@Override
public void onPageSelected(int position) {
if (actionBar != null) {
actionBar.setSelectedNavigationItem(position);
}
}
@Override
public void onPageScrollStateChanged(int state)
{
if (state == ViewPager.SCROLL_STATE_IDLE)
{
((InputMethodManager)getSystemService(INPUT_METHOD_SERVICE))
.hideSoftInputFromWindow(mViewPager.getWindowToken(), 0);
}
}
});
And here is the activity in AndroidManifest.xml:
<activity
android:name=".TestActivity"
android:label="@string/title_activity_test"
android:parentActivityName=".MainActivity"
android:windowSoftInputMode="stateHidden">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.atrinax.test.MainActivity" />
</activity>
source
share