本文整理汇总了Java中android.support.v4.view.ViewCompat.setLayoutDirection方法的典型用法代码示例。如果您正苦于以下问题:Java ViewCompat.setLayoutDirection方法的具体用法?Java ViewCompat.setLayoutDirection怎么用?Java ViewCompat.setLayoutDirection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.view.ViewCompat
的用法示例。
在下文中一共展示了ViewCompat.setLayoutDirection方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: putLayoutDirectionIntoMap
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
private static void putLayoutDirectionIntoMap(AmazonWebView webView, Map<String, String> substitutionMap) {
ViewCompat.setLayoutDirection(webView, View.LAYOUT_DIRECTION_LOCALE);
final int layoutDirection = ViewCompat.getLayoutDirection(webView);
final String direction;
if (layoutDirection == View.LAYOUT_DIRECTION_LTR) {
direction = "ltr";
} else if (layoutDirection == View.LAYOUT_DIRECTION_RTL) {
direction = "rtl";
} else {
direction = "auto";
}
substitutionMap.put("%dir%", direction);
}
示例2: initScrollView
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
private void initScrollView(){
mScrollView = new InternalScrollView(getContext());
mScrollView.setPadding(0, 0, 0, mContentPadding - mActionPadding_h);
mScrollView.setClipToPadding(false);
mScrollView.setFillViewport(true);
mScrollView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);
ViewCompat.setLayoutDirection(mScrollView, View.LAYOUT_DIRECTION_INHERIT);
}
示例3: initListView
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
private void initListView(){
mListView = new InternalListView(getContext());
mListView.setDividerHeight(0);
mListView.setCacheColorHint(0x00000000);
mListView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);
mListView.setClipToPadding(false);
mListView.setSelector(BlankDrawable.getInstance());
mListView.setPadding(0, 0, 0, mContentPadding - mActionPadding_h);
mListView.setVerticalFadingEdgeEnabled(false);
mListView.setOverScrollMode(ListView.OVER_SCROLL_NEVER);
ViewCompat.setLayoutDirection(mListView, ViewCompat.LAYOUT_DIRECTION_INHERIT);
mAdapter = new InternalAdapter();
mListView.setAdapter(mAdapter);
}
示例4: correctDiretion
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public void correctDiretion()
{
boolean numIsRtl=true;
if (ViewCompat.getLayoutDirection(this) != View.LAYOUT_DIRECTION_RTL) {
numIsRtl = false;
}
ViewCompat.setLayoutDirection(this, View.LAYOUT_DIRECTION_LTR);
this.setGravity(numIsRtl ? Gravity.LEFT : Gravity.RIGHT);
}
示例5: getLayoutManager
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@UiThread
@Override
protected ChipsLayoutManager getLayoutManager() {
ChipsLayoutManager layoutManager = super.getLayoutManager();
if (activityTestRule.getActivity() != null) {
View recyclerView = activityTestRule.getActivity().findViewById(R.id.rvTest);
ViewCompat.setLayoutDirection(recyclerView, ViewCompat.LAYOUT_DIRECTION_RTL);
}
return layoutManager;
}
示例6: setupLayoutDirection
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public void setupLayoutDirection() {
ViewCompat.setLayoutDirection(getWindow().getDecorView(), ViewCompat.LAYOUT_DIRECTION_LTR);
// previous way of setting layout direction, the new one works below API 17 so that's good
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
// getWindow().getDecorView().setLayoutDirection(View.LAYOUT_DIRECTION_LTR);
// }
}
示例7: setLayoutDirection
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
/**
* Force set layout direction to RTL or LTR by Locale.
*
* @param view
* @param locale
*/
public static void setLayoutDirection(View view, Locale locale) {
switch (TextUtilsCompat.getLayoutDirectionFromLocale(locale)) {
case ViewCompat.LAYOUT_DIRECTION_RTL:
ViewCompat.setLayoutDirection(view, ViewCompat.LAYOUT_DIRECTION_RTL);
break;
case ViewCompat.LAYOUT_DIRECTION_LTR:
default:
ViewCompat.setLayoutDirection(view, ViewCompat.LAYOUT_DIRECTION_LTR);
break;
}
}
示例8: onCreateView
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
final Bundle savedInstanceState) {
final View view = super.onCreateView(inflater, container, savedInstanceState);
// For correct display in RTL locales, we need to set the layout direction of the
// fragment's top view.
ViewCompat.setLayoutDirection(view, ViewCompat.LAYOUT_DIRECTION_LOCALE);
return view;
}
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:10,代码来源:CustomInputStyleSettingsFragment.java
示例9: setLayoutDirection
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
public void setLayoutDirection(final boolean isRtlLanguage) {
final int layoutDirection = isRtlLanguage ? ViewCompat.LAYOUT_DIRECTION_RTL
: ViewCompat.LAYOUT_DIRECTION_LTR;
ViewCompat.setLayoutDirection(mSuggestionStripView, layoutDirection);
ViewCompat.setLayoutDirection(mSuggestionsStrip, layoutDirection);
ViewCompat.setLayoutDirection(mImportantNoticeStrip, layoutDirection);
}
示例10: onCreate
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_about);
ButterKnife.bind(this);
ViewCompat.setLayoutDirection(getWindow().getDecorView(), ViewCompat.LAYOUT_DIRECTION_RTL);
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
// cache current devmode state
developerModeActive = prefs.getBoolean(getString(R.string.pref_advanced_mode_bool), false);
if (developerModeActive) {
// show button if devmode is enabled already, as a way to disable it
btnEasterEgg.setBackgroundResource(android.R.drawable.btn_default);
} else {
btnEasterEgg.setText("");
}
btnEasterEgg.setOnClickListener(v -> {
if (!developerModeActive) {
// only if devmode isn't enabled
if (easterEggClickCounter == clickCounterMax) {
// update prefs
prefs.edit().putBoolean(getString(R.string.pref_advanced_mode_bool), developerModeActive = true).apply();
// alert user
if (toast != null) {
toast.cancel();
}
toast = Toast.makeText(getApplicationContext(), getString(R.string.toast_devmode_enabled), Toast.LENGTH_LONG);
toast.show();
btnEasterEgg.setBackgroundResource(android.R.drawable.btn_default);
btnEasterEgg.setText(getString(R.string.btn_devmode_easteregg));
} else {
// increase count
easterEggClickCounter++;
if (easterEggClickCounter >= 4) {
if (toast != null) {
toast.cancel();
}
// the extra space is because android removes spaces from strings
toast = Toast.makeText(getApplicationContext(),
(clickCounterMax - easterEggClickCounter + 1) + " " +
getString(R.string.toast_devmode_clicks_remaining),
Toast.LENGTH_LONG);
toast.show();
}
}
} else {
prefs.edit().putBoolean(getString(R.string.pref_advanced_mode_bool), developerModeActive = false).apply();
btnEasterEgg.setBackgroundResource(android.R.color.transparent);
btnEasterEgg.setText("");
easterEggClickCounter = 0;
if (toast != null) {
toast.cancel();
}
toast = Toast.makeText(getApplicationContext(), getString(R.string.toast_devmode_disabled), Toast.LENGTH_LONG);
toast.show();
}
});
}
示例11: layoutDirection
import android.support.v4.view.ViewCompat; //导入方法依赖的package包/类
/**
* Set the layout direction of this Dialog
* @param direction The layout direction value. Can be {@link View#LAYOUT_DIRECTION_LTR}, {@link View#LAYOUT_DIRECTION_RTL} or {@link View#LAYOUT_DIRECTION_LOCALE}
* @return The Dialog for chaining methods.
*/
public Dialog layoutDirection(int direction){
ViewCompat.setLayoutDirection(mCardView, direction);
return this;
}